\Hazaar\Html
Img
The HTML img class.

Displays an HTML <img> element.

Tags

Since

1.1

Summary
Methods Properties Constants
No constants
Properties
$map
$map
Inherited
$style
$style
Inherited
$type
$type
Methods
__construct()
__construct($src, $alt = null, $parameters = Array ( ) )

The HTML img constructor.

Tags

Since

1.1

Parameters

$srcmixed

The source URL of the image. This can be either a string or an Hazaar\Html\Url object.

$alt

No description

$parametersarray

Optional parameters to apply to the anchor.

renderObject()
renderObject() : string

Html render override. This method overrides the standard object render method and allows a \Hazaar\Html\Map

Tags

Since

1.1

Returns

string
usemap()
usemap($map) : \Hazaar\Html\Img

Configure the image with a object. This will set the usemap attribute and, if the $map parameter is a \Hazaar\Html\Map object, it will render the map object automatically when rendering the image.

Tags

Since

1.2

Parameters

$mapmixed

The name of the map to use, or a \Hazaar\Html\Map object.

Returns

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

Set a parameter on the current HTML element

Tags

Since

1.0.0

Parameters

$keystring

The name of the parameter to set.

$value

No description

Returns

\\Hazaar\\Html\Element

Returns a ref to self.

Inherited
__tostring()
__tostring() : string

Magic method to convert the element to a string.

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

Tags

Since

1.0.0

Returns

string
Inherited
addClass()
addClass($class) : $this
Adds a class to the HTML element

Parameters

$classstring

No description

Returns

\Hazaar\Html\this
Inherited
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.

Tags

Since

1.0.0

Returns

string
Inherited
attr()
attr($key, $value = null) : \\Hazaar\\Html\Element

Get/Set an attribute on the current HTML element

Tags

Since

1.0.0

Parameters

$keystring

The name of the parameter to set.

$value

No description

Returns

\\Hazaar\\Html\Element

Returns a ref to self.

Inherited
data()
data($key, $value)

Parameters

$key

No description

$value

No description

Inherited
hasClass()
hasClass($class) : bool
Test if a class has been added to an HTML element

Parameters

$classstring

The class to check for

Returns

\Hazaar\Html\bool

TRUE if the class has been set

Inherited
parameters()
parameters()
Inherited
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.

Parameters

$keystring

The property to set on the element.

$enabledboolean

If TRUE the property will be added. If FALSE the property will not be added or it will be removed if it already exists.

Returns

\Hazaar\Html\Element
Inherited
style()
style()
Inherited
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.

Parameters

$class

No description

$boolean

No description

Returns

\Hazaar\Html\this