class MetaTags extends GroupedTagBuilder

Methods

static string
key()

Get the builder key.

overlayOn(TagBuilder|null $base)

Overlay these meta tags onto the lower layer.

bool
isEmpty()

Determine whether no meta tags are defined.

static string
headArrayKey()

Get the dot-notated key this builder occupies in the Head::toArray() result.

static mixed
headArrayDefault()

Grouped tag builders are represented as an empty array when absent from the Head::toArray() result.

static array
routeAttributeKeys()

Get the supported route attribute names.

static TagBuilder|null
fromRouteAttribute(string $key, mixed $value)

Build meta tags from a route attribute or alias.

static bool
rendersWhenEmpty(ResolvedHead $head)

Determine if the builder should render even when no data was set.

asDefaults()

Mark the builder's data as belonging to the defaults layer.

mixed
toHeadArray(ResolvedHead $head)

Get the meta tags for the head array.

array
toTags(ResolvedHead $head, TagRenderer $tags)

Render the meta tags.

static string|null
string(mixed $value)

Return the value when it is a string.

static string|null
stringOrBackedEnum(mixed $value)

Resolve a string or string-backed enum value.

static bool|null
bool(mixed $value)

Return the value when it is a boolean.

static int|null
int(mixed $value)

Return the value when it is an integer.

static array
items(mixed $value)

Normalize a route attribute value into a list of items.

static array
named(array $values)

Filter an array down to its string-keyed values.

__construct(array $tags = [])

Create the meta tag definitions.

tag(string $key, string $content, bool|null $property = null, Media|string|null $media = null)

Add or replace a meta tag for its attribute, key, and media.

array
headArray()

Get the ordered meta tag definitions.

bool
isRdfaProperty(string $key)

Determine whether the key belongs to an RDFa namespace.

string
resolveAttribute(string $key, bool|null $property)

Resolve the HTML attribute a meta tag is keyed under, honoring an explicit property flag and falling back to RDFa namespace detection.

string
tagKey(string $key, bool|null $property, string|null $media)

Get the identity a meta tag is deduplicated by: attribute, key, and media query.

string
inertiaKey(array $meta)

Get the stable Inertia ownership key for a meta tag.

static array
aliases()

Get the route attribute aliases for meta tag names.

static array
inertiaAliases()

Get the Inertia ownership aliases for meta tag names.

Details

at line 31
static string key()

Get the builder key.

Return Value

string

at line 103
TagBuilder overlayOn(TagBuilder|null $base)

Overlay these meta tags onto the lower layer.

Parameters

TagBuilder|null $base

Return Value

TagBuilder

at line 115
bool isEmpty()

Determine whether no meta tags are defined.

Return Value

bool

in TagBuilder at line 32
static string headArrayKey()

Get the dot-notated key this builder occupies in the Head::toArray() result.

Return Value

string

in GroupedTagBuilder at line 13
static mixed headArrayDefault()

Grouped tag builders are represented as an empty array when absent from the Head::toArray() result.

Return Value

mixed

at line 78
static array routeAttributeKeys()

Get the supported route attribute names.

Return Value

array

at line 39
static TagBuilder|null fromRouteAttribute(string $key, mixed $value)

Build meta tags from a route attribute or alias.

Parameters

string $key
mixed $value

Return Value

TagBuilder|null

in TagBuilder at line 66
static bool rendersWhenEmpty(ResolvedHead $head)

Determine if the builder should render even when no data was set.

Parameters

ResolvedHead $head

Return Value

bool

in TagBuilder at line 74
TagBuilder asDefaults()

Mark the builder's data as belonging to the defaults layer.

Return Value

TagBuilder

at line 125
mixed toHeadArray(ResolvedHead $head)

Get the meta tags for the head array.

Parameters

ResolvedHead $head

Return Value

mixed

at line 135
array toTags(ResolvedHead $head, TagRenderer $tags)

Render the meta tags.

Parameters

ResolvedHead $head
TagRenderer $tags

Return Value

array

in TagBuilder at line 100
static protected string|null string(mixed $value)

Return the value when it is a string.

Parameters

mixed $value

Return Value

string|null

in TagBuilder at line 108
static protected string|null stringOrBackedEnum(mixed $value)

Resolve a string or string-backed enum value.

Parameters

mixed $value

Return Value

string|null

in TagBuilder at line 124
static protected bool|null bool(mixed $value)

Return the value when it is a boolean.

Parameters

mixed $value

Return Value

bool|null

in TagBuilder at line 132
static protected int|null int(mixed $value)

Return the value when it is an integer.

Parameters

mixed $value

Return Value

int|null

in TagBuilder at line 142
static protected array items(mixed $value)

Normalize a route attribute value into a list of items.

Parameters

mixed $value

Return Value

array

in TagBuilder at line 153
static protected array named(array $values)

Filter an array down to its string-keyed values.

Parameters

array $values

Return Value

array

at line 24
__construct(array $tags = [])

Create the meta tag definitions.

Parameters

array $tags

at line 86
MetaTags tag(string $key, string $content, bool|null $property = null, Media|string|null $media = null)

Add or replace a meta tag for its attribute, key, and media.

Parameters

string $key
string $content
bool|null $property
Media|string|null $media

Return Value

MetaTags

at line 152
protected array headArray()

Get the ordered meta tag definitions.

Return Value

array

at line 160
protected bool isRdfaProperty(string $key)

Determine whether the key belongs to an RDFa namespace.

Parameters

string $key

Return Value

bool

at line 169
protected string resolveAttribute(string $key, bool|null $property)

Resolve the HTML attribute a meta tag is keyed under, honoring an explicit property flag and falling back to RDFa namespace detection.

Parameters

string $key
bool|null $property

Return Value

string

at line 177
protected string tagKey(string $key, bool|null $property, string|null $media)

Get the identity a meta tag is deduplicated by: attribute, key, and media query.

Parameters

string $key
bool|null $property
string|null $media

Return Value

string

at line 191
protected string inertiaKey(array $meta)

Get the stable Inertia ownership key for a meta tag.

Parameters

array $meta

Return Value

string

at line 206
static protected array aliases()

Get the route attribute aliases for meta tag names.

Return Value

array

at line 225
static protected array inertiaAliases()

Get the Inertia ownership aliases for meta tag names.

Return Value

array