Element
class Element
Element class
Properties
protected | $name | ||
protected | $attributes | ||
protected | $children | ||
protected | $empty | ||
static protected | $emptyElements |
Methods
__construct(string $name, array $attributes = array(), array $children = array())
Element constructor.
$this
attr(string $key, string $value, bool $append = false)
add attribute
$this
removeAttr(string $key)
remove attribute
$this
addClass(string $class)
add class
$this
removeClass(string $class)
remove class
$this
html(string $html)
set html or text to sole child
string
render()
render
string
__toString()
__toString
void
resolveAttribute(string $key)
transform attribute to array format
Details
at line 62
__construct(string $name, array $attributes = array(), array $children = array())
Element constructor.
at line 81
$this
attr(string $key, string $value, bool $append = false)
add attribute
at line 101
$this
removeAttr(string $key)
remove attribute
at line 114
$this
addClass(string $class)
add class
at line 129
$this
removeClass(string $class)
remove class
at line 146
$this
append(string|Element $el)
append child
at line 164
$this
prepend(string|Element $el)
prepend child
at line 179
$this
html(string $html)
set html or text to sole child
at line 190
string
render()
render
at line 225
string
__toString()
__toString
at line 241
protected void
resolveAttribute(string $key)
transform attribute to array format