Baigudin Software avatar
Baigudin Software logo
home
ru region
en region

PHP DOM Builder API 2.0

BOOS Core is unveiled in second revision

BOOS Core Revision 2 has been successfully unveiled within the framework of Baigudin Software project. In comparison with the first revision, the second has gotten considerable improvements. It saves the best features of previous realization and gets the new logical continuation.

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