Baigudin Software avatar
Baigudin Software logo
home
ru region
en region

PHP DOM Builder API 2.0

Baigudin Software registers the copyright of its own operating system – Embedded Object Operating System

The Russian Federal Service for Intellectual Property (Rospatent) registers the copyright of Embedded Object Operating System – Baigudin Software’s own embedded object-oriented real-time operating system.

Interface «DomBuilder\Api\Attribute»

Elements attributes access declaration.

  • interface Api\Attribute

All superinterfaces:

Object

public Element addAttr(string|array $name, string $value=NULL);

Adds a new value to an attribute.

The method adds a new value to an attribute of each element. If given attribute is already set, the method adds a new value of this attribute.

Parameters:
string|array $name — string with attribute name or array where key is attribute name and value is attribute value.
string $value — given attribute name value. if first argument is given as array type, this field is be skipped.

Returns:
Element — this element.

public Element addClass(string $value);

Adds new class attribute value.

The method sets new value for class attribute of each element. If class attribute is set, the method adds new value of attribute.

Parameters:
string $value — new class attribute value.

Returns:
Element — this element.

public string|Element attr(string|array $name, string $value=NULL);

Returns an attribute value or sets attributes and its values.

The method returns an attribute value of the first element or sets new value of given attribute name for each element. If given attribute is already set, the method sets new given value of the attribute.

Parameters:
string|array $name — string with attribute name or array where key is attribute name and value is attribute value.
string $value — given attribute name value. If first argument is given as array type, this field is skipped.

Returns:
string|Element — a current attribute value or this element.

public Element removeAttr(string|array $name);

Removes attribute of each element.

Parameters:
string|array $name — string with attribute name or array of attribute names.

Returns:
Element — this element.

public Element removeClass(string $value);

Removes class attribute value.

Parameters:
string $value — class attribute value.

Returns:
Element — this element.

Back to class list