Reference

Guide

Html::attr()

Generates a single attribute or a list of attributes

Html::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

Inherited from

Kirby\Toolkit\Html

Source code

kirby/src/Toolkit/Html.php#L85