AlternateLinks
class AlternateLinks extends GroupedTagBuilder
Methods
Get the builder key.
Determine whether no alternate links are defined.
Get the key used in the head array.
Grouped tag builders are represented as an empty array when absent from the Head::toArray() result.
Get the route attribute keys this builder accepts values for.
Build alternate links from a route attribute.
Determine if the builder should render even when no data was set.
Resolve a string or string-backed enum value.
Normalize a route attribute value into a list of items.
Create the localized alternate links.
Set the alternate link for a locale.
Details
at line 27
static string
key()
Get the builder key.
at line 73
TagBuilder
overlayOn(TagBuilder|null $base)
Overlay these locales onto the lower layer.
at line 85
bool
isEmpty()
Determine whether no alternate links are defined.
at line 35
static string
headArrayKey()
Get the key used in the head array.
in
GroupedTagBuilder at line 13
static mixed
headArrayDefault()
Grouped tag builders are represented as an empty array when absent from the Head::toArray() result.
in
TagBuilder at line 50
static array
routeAttributeKeys()
Get the route attribute keys this builder accepts values for.
at line 43
static TagBuilder|null
fromRouteAttribute(string $key, mixed $value)
Build alternate links from a route attribute.
in
TagBuilder at line 66
static bool
rendersWhenEmpty(ResolvedHead $head)
Determine if the builder should render even when no data was set.
in
TagBuilder at line 74
TagBuilder
asDefaults()
Mark the builder's data as belonging to the defaults layer.
at line 95
mixed
toHeadArray(ResolvedHead $head)
Get the alternate links as an array.
at line 105
array
toTags(ResolvedHead $head, TagRenderer $tags)
Render the localized alternate link tags.
in
TagBuilder at line 100
static protected string|null
string(mixed $value)
Return the value when it is a string.
in
TagBuilder at line 108
static protected string|null
stringOrBackedEnum(mixed $value)
Resolve a string or string-backed enum value.
in
TagBuilder at line 124
static protected bool|null
bool(mixed $value)
Return the value when it is a boolean.
in
TagBuilder at line 132
static protected int|null
int(mixed $value)
Return the value when it is an integer.
in
TagBuilder at line 142
static protected array
items(mixed $value)
Normalize a route attribute value into a list of items.
in
TagBuilder at line 153
static protected array
named(array $values)
Filter an array down to its string-keyed values.
at line 20
__construct(array $links = [])
Create the localized alternate links.
at line 63
AlternateLinks
link(string $locale, string $href)
Set the alternate link for a locale.