TagBuilder
abstract class TagBuilder implements Transient
Methods
Get the unique name identifying this builder within the head.
Merge this builder over the given base builder, preferring this builder's values.
Determine whether the builder has no data.
Get the dot-notated key this builder occupies in the Head::toArray() result.
Get the value used in Head::toArray() when this builder has no data.
Get the route attribute keys this builder accepts values for.
Create a builder from a route attribute value, or null when the value is invalid.
Determine if the builder should render even when no data was set.
Mark the builder's data as belonging to the defaults layer.
Convert this builder into the HTML tags rendered by @head.
Return the value when it is a string.
Resolve a string or string-backed enum value.
Return the value when it is a boolean.
Return the value when it is an integer.
Normalize a route attribute value into a list of items.
Filter an array down to its string-keyed values.
Details
at line 17
abstract static string
key()
Get the unique name identifying this builder within the head.
at line 22
abstract TagBuilder
overlayOn(TagBuilder|null $base)
Merge this builder over the given base builder, preferring this builder's values.
at line 27
abstract bool
isEmpty()
Determine whether the builder has no data.
at line 32
static string
headArrayKey()
Get the dot-notated key this builder occupies in the Head::toArray() result.
at line 40
static mixed
headArrayDefault()
Get the value used in Head::toArray() when this builder has no data.
at line 50
static array
routeAttributeKeys()
Get the route attribute keys this builder accepts values for.
at line 58
static TagBuilder|null
fromRouteAttribute(string $key, mixed $value)
Create a builder from a route attribute value, or null when the value is invalid.
at line 66
static bool
rendersWhenEmpty(ResolvedHead $head)
Determine if the builder should render even when no data was set.
at line 74
TagBuilder
asDefaults()
Mark the builder's data as belonging to the defaults layer.
at line 82
mixed
toHeadArray(ResolvedHead $head)
Convert this builder into its Head::toArray() value.
at line 92
array
toTags(ResolvedHead $head, TagRenderer $tags)
Convert this builder into the HTML tags rendered by @head.
at line 100
static protected string|null
string(mixed $value)
Return the value when it is a string.
at line 108
static protected string|null
stringOrBackedEnum(mixed $value)
Resolve a string or string-backed enum value.
at line 124
static protected bool|null
bool(mixed $value)
Return the value when it is a boolean.
at line 132
static protected int|null
int(mixed $value)
Return the value when it is an integer.
at line 142
static protected array
items(mixed $value)
Normalize a route attribute value into a list of items.
at line 153
static protected array
named(array $values)
Filter an array down to its string-keyed values.