Hazaar\Html
Element
Abstract
Abstract base element class

This class is the base element class from which all HTML elements are built upon. It contains common methods and properties for all elements. It also enforces the use of __tostring() to output string renders of the object to form HTML content.

Implements
Summary
MethodsPropertiesConstants
No constants
Properties
$parameters
$parameters
$style
$style
$type
$type
Methods
__call()
__call($method, $args) : string

Chaining method to set a parameter on the element. As event parameters all start with 'on' this will check for event parameters and ensure that they are quoted correctly so that execution will not fail.

__construct()
__construct($type = null, $parameters = Array ( ) )

The HTML element constructor takes two arguments. The type of the element which is defined by the available types in the HTML standards. eg: A, DIV, SPAN, etc. The second argument is an array of parameters to apply to the element such as width, height, style, etc. The parameters are also defined by the current HTML standards.

The available types and parameters are not restricted by this class and so ANY type, valid or not, can be specified. It is up to the developer to ensure that the HTML element types they use adhere to the standards for which they are trying to comply.

__get()
__get($key) : mixed

Magic method to allow getting of parameters by property access.

__set()
__set($key, $value) : \\Hazaar\\Html\Element

Set a parameter on the current HTML element

__tostring()
__tostring() : string

Magic method to convert the element to a string.

Calls the methods renderObject() method to render the object as a string.

addClass()
addClass($class) : $this
Adds a class to the HTML element
appendTo()
appendTo($element) : Element
Append the element to another.

This is the same as calling add() on the other element but is more convenient in some cases.

asHtml()
asHtml() : string

Render the element as HTML using ascii special characters. This allows elements to easily be displayed without being rendered in the browser. Great for use inside

 elements.

attr()
attr($key, @value) : \\Hazaar\\Html\Element

Get/Set an attribute on the current HTML element

data()
data($key, $value)
getTypeName()
getTypeName()
hasClass()
hasClass($class) : bool
Test if a class has been added to an HTML element
hide()
hide()
Shorthand method to set an element not visible
parameters()
parameters()
prop()
prop($key, $enabled = true) : Element
Enable or disable a property.

Some element types have properties that have no value. A good example is "checked" on a checkbox or radio, or "enabled" on an input. This method allows these properties to be added or removed without requiring a value.

show()
show()
Shorthand method to set an element visible
style()
style()
toggleClass()
toggleClass($class, $boolean = false) : $this;
Set's a class based on a boolean value.

This is handy for adding a class only if a boolean value is true and can be used as shorthand in place of in 'if' statement that selectively adds the class as this may not be desired in a view.