Skip to main content

HtmlAttributesSet

Class for storing and processing HTML tag attributes.


Properties

attributeWithSet

protected static $attributeWithSet
  • This property is static.

Methods

__construct

Constructor.

public __construct(\Laminas\Escaper\Escaper $htmlEscaper, iterable $attributes = []): mixed

Parameters:

ParameterTypeDescription
$htmlEscaper\Laminas\Escaper\EscaperGeneral HTML escaper
$attributesiterableAttributes to manage

offsetGet

public offsetGet(mixed $key): mixed

Parameters:

ParameterTypeDescription
$keymixed

offsetsUnset

public offsetsUnset(iterable $keys): self

Parameters:

ParameterTypeDescription
$keysiterable

offsetUnset

public offsetUnset(mixed $key): void

Parameters:

ParameterTypeDescription
$keymixed

merge

Merge attributes with existing attributes.

public merge(\TwbsHelper\View\AttributeSet|\TwbsHelper\View\HtmlAttributesSet $attributes): self

Parameters:

ParameterTypeDescription
$attributes\TwbsHelper\View\AttributeSet|\TwbsHelper\View\HtmlAttributesSet

getArrayCopy

public getArrayCopy(): array

__toString

Return a string of tag attributes.

public __toString(): string

cleanAttributes

protected cleanAttributes(): self

Inherited methods

__construct

public __construct(\Laminas\Escaper\Escaper $escaper, iterable $attributes = []): mixed

Parameters:

ParameterTypeDescription
$escaper\Laminas\Escaper\Escaper
$attributesiterable

set

Set several attributes at once.

public set(\TwbsHelper\View\AttributeSet $attributes): self

Parameters:

ParameterTypeDescription
$attributes\TwbsHelper\View\AttributeSet

add

Add a value to an attribute.

public add(string $name, scalar|array|null $value): self

Sets the attribute if it does not exist.

Parameters:

ParameterTypeDescription
$namestring
$valuescalar|array|null

merge

Merge attributes with existing attributes.

public merge(\TwbsHelper\View\AttributeSet $attributes): self

Parameters:

ParameterTypeDescription
$attributes\TwbsHelper\View\AttributeSet

hasValue

Whether the named attribute equals or contains the given value

public hasValue(string $name, scalar|array|null $value): bool

Parameters:

ParameterTypeDescription
$namestring
$valuescalar|array|null

__toString

Return a string of tag attributes.

public __toString(): string