Skip to content

Xml::attr()

Generates a single attribute or a list of attributes

Xml::attr(string|array $name, mixed $value = null): string|null

Parameters

Name Type Default Description
$name * string|array 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.

Return type

string|null

Parent class

Kirby\Toolkit\Xml