API Documentation for: 1.1.1
Show:

Attribute Class

Namespace: Canteen\HTML5

An HTML attribute used on the Node, this is used internally. Do not initiate this class directly, use the html() function to create attributes on elements.

echo html('a', 'Link', 'class=button href="about.html"');

echo html('a', 'Link')
    ->setAttribute('class', 'button')
    ->setAttribute('href', 'about.html');

Constructor

Attribute

(
  • [name=null]
  • [value=null]
)

Parameters:

  • [name=null] String optional

    The name of the attribute

  • [value=null] String optional

    The value of the attribute

Item Index

Properties

Methods

__isset

(
  • name
)

See if a property exists

Parameters:

  • name String

    The name of the property

__toString

() String

Convert the attribute to an HTML tag attribute string

Returns:

String:

String representation of attribute

getName

() String

Get the name of this attribute

Returns:

String:

The attribute's name

getValue

() String protected

Get the value of this attribute

Returns:

String:

The value of attribute

setName

(
  • [name=null]
)

Set the name of this attribute, cannot be empty

Parameters:

  • [name=null] String optional

    The name of the attribute

setValue

(
  • value
)
protected

Set the value of this attribute, this cannot be empty

Parameters:

  • value String

    The value to set

shorthand

(
  • str
)
Dictionary static

Convert a string into an associative array

Parameters:

  • str String

    The string, delineated by semicolons, and colons for attributes:values

Returns:

Dictionary:

The collection of attributes

Properties

_name

String private

The name of the attribute

_value

String private

The value of the attribute