Skip to content

Kirby 3.9.8

Html::attr()

Generates a single attribute or a list of attributes

Html::attr(array|string $name, mixed $value = null, ?string $before = null, ?string $after = null): string|null

Parameters

Name Type Default Description
$name * array|string String: A single attribute with that name will be generated.
Key-value array: A list of attributes will be generated. Don't pass a second argument in that case.
$value mixed null If used with a $name string, pass the value of the attribute here.
If used with a $name array, this can be set to false to disable attribute sorting.
$before string|null null An optional string that will be prepended if the result is not empty
$after string|null null An optional string that will be appended if the result is not empty

Return type

string|null

Parent class

Kirby\Cms\Html inherited from Kirby\Toolkit\Html