Skip to content
PHP Ecosystem
Explore

HasSuffixCollection

API reference › HTML Mixin › HasSuffixCollection

traitUIAwesome\Html\Mixin\HasSuffixCollection
Sourcesrc/HasSuffixCollection.php
Used by 2 types

Provides an immutable API for managing suffix element and its attributes.

PropertyTypeDescriptionDefined by
$suffix protectedstringSuffix content string assigned to the element. Default: ''.HasSuffixCollection
$suffixAttributes protectedarrayHTML attributes array for the suffix element. Default: [].HasSuffixCollection
$suffixTag protectedfalse|UnitEnumTag name for the suffix element, or false to disable. Default: false.HasSuffixCollection
MethodDescriptionDefined by
getSuffix()Returns the suffix content string assigned to the element.HasSuffixCollection
getSuffixAttribute()Returns the value of a single HTML attribute for the suffix element attributes.HasSuffixCollection
getSuffixAttributes()Returns the array of HTML attributes for the suffix element.HasSuffixCollection
getSuffixTag()Returns the tag name for the suffix element.HasSuffixCollection
suffix()Sets the suffix content string for the element.HasSuffixCollection
suffixAttributes()Sets the HTML attributes for the suffix element.HasSuffixCollection
suffixClass()Adds a CSS class to the suffix element attributes.HasSuffixCollection
suffixRemoveAttribute()Removes a specific HTML attribute from the suffix element.HasSuffixCollection
suffixSetAttribute()Sets a single HTML attribute for the suffix element.HasSuffixCollection
suffixTag()Sets the tag type for the suffix element.HasSuffixCollection
public function getSuffix(): string

Returns the suffix content string assigned to the element.

Returns

string: Suffix content string assigned to the element.

public function getSuffixAttribute(string|UnitEnum $key, mixed $default = null, string $prefix = ''): mixed

Returns the value of a single HTML attribute for the suffix element attributes.

Parameters

ParameterTypeDescription
$keystring|UnitEnumAttribute name.
$defaultmixedDefault value when the attribute is missing.
$prefixstringPrefix to ensure (for example, aria-, data-, on).

Returns

mixed: Attribute value or default.

public function getSuffixAttributes(): array

Returns the array of HTML attributes for the suffix element.

Returns

array: Attributes array assigned to the suffix element.

public function getSuffixTag(): false|UnitEnum

Returns the tag name for the suffix element.

Returns

false|UnitEnum: Tag name for the suffix element, or false to disable.

public function suffix(string|Stringable ...$values): static

Sets the suffix content string for the element.

Parameters

ParameterTypeDescription
...$valuesstring|StringableSuffix content to set for the element.

Returns

static: New instance with the updated suffix value.

public function suffixAttributes(array $values, string $prefix = ''): static

Sets the HTML attributes for the suffix element.

Parameters

ParameterTypeDescription
$valuesarrayAssociative array of attribute keys and values.
$prefixstringPrefix to ensure (for example, aria-, data-, on).

Returns

static: New instance with the updated suffixAttributes value.

public function suffixClass(string|Stringable|UnitEnum|null $value, bool $override = false): static

Adds a CSS class to the suffix element attributes.

Parameters

ParameterTypeDescription
$valuestring|Stringable|UnitEnum|nullCSS class name to add.
$overrideboolWhether to override existing class value.

Returns

static: New instance with the updated suffixAttributes value.

public function suffixRemoveAttribute(string|UnitEnum $key, string $prefix = ''): static

Removes a specific HTML attribute from the suffix element.

Parameters

ParameterTypeDescription
$keystring|UnitEnumAttribute name to remove.
$prefixstringPrefix to ensure (for example, aria-, data-, on).

Returns

static: New instance without the specified suffix attribute.

public function suffixSetAttribute(string|UnitEnum $key, mixed $value, string $prefix = ''): static

Sets a single HTML attribute for the suffix element.

Parameters

ParameterTypeDescription
$keystring|UnitEnumAttribute name.
$valuemixedAttribute value.
$prefixstringPrefix to ensure (for example, aria-, data-, on).

Returns

static: New instance with the updated suffixAttributes value.

public function suffixTag(false|UnitEnum $value = false): static

Sets the tag type for the suffix element.

Parameters

ParameterTypeDescription
$valuefalse|UnitEnumTag name for the suffix element, or false to disable.

Returns

static: New instance with the updated suffixTag value.