class HeadRenderer

Properties

protected TagRenderer $tags

Methods

__construct(SchemaValidator $schemas, TagRegistry $registry, TagRenderer|null $tags = null)

Create the head renderer.

string
render(HeadData $head, Request|null $request = null)

Render the resolved head as an HTML string.

string
renderInertiaDocument(HeadData $inertiaGlobals, HeadData $head, Request|null $request = null)

Render the initial Inertia document head as an HTML string.

array
toElements(HeadData $head, Request|null $request = null)

Render the resolved head as individual HTML element strings.

array
toInertiaElements(HeadData $head, Request|null $request = null)

Render the resolved head as individual HTML element strings with stable data-inertia keys for Inertia's server-managed head reconciler.

string
withoutInertiaElements(string $html, array $elements)

Remove exact Inertia elements from an HTML string.

array
toInertiaDocumentElements(HeadData $inertiaGlobals, HeadData $head, Request|null $request = null)

Render the initial Inertia document head. Inertia globals are emitted as plain, server-owned tags while page tags receive Inertia ownership keys.

array
uniqueInertiaElements(array $elements)

Apply Inertia's last-write-wins ownership semantics to rendered elements.

array
elements(HeadData $head, Request|null $request, TagRenderer $tags)

Render every builder in the resolved head.

array
toArray(HeadData $head, Request|null $request = null)

Render the resolved head as the array returned by Head::toArray().

Details

at line 22
__construct(SchemaValidator $schemas, TagRegistry $registry, TagRenderer|null $tags = null)

Create the head renderer.

Parameters

SchemaValidator $schemas
TagRegistry $registry
TagRenderer|null $tags

at line 33
string render(HeadData $head, Request|null $request = null)

Render the resolved head as an HTML string.

Parameters

HeadData $head
Request|null $request

Return Value

string

at line 41
string renderInertiaDocument(HeadData $inertiaGlobals, HeadData $head, Request|null $request = null)

Render the initial Inertia document head as an HTML string.

Parameters

HeadData $inertiaGlobals
HeadData $head
Request|null $request

Return Value

string

at line 51
array toElements(HeadData $head, Request|null $request = null)

Render the resolved head as individual HTML element strings.

Parameters

HeadData $head
Request|null $request

Return Value

array

at line 62
array toInertiaElements(HeadData $head, Request|null $request = null)

Render the resolved head as individual HTML element strings with stable data-inertia keys for Inertia's server-managed head reconciler.

Parameters

HeadData $head
Request|null $request

Return Value

array

at line 74
string withoutInertiaElements(string $html, array $elements)

Remove exact Inertia elements from an HTML string.

Parameters

string $html
array $elements

Return Value

string

at line 85
array toInertiaDocumentElements(HeadData $inertiaGlobals, HeadData $head, Request|null $request = null)

Render the initial Inertia document head. Inertia globals are emitted as plain, server-owned tags while page tags receive Inertia ownership keys.

Parameters

HeadData $inertiaGlobals
HeadData $head
Request|null $request

Return Value

array

at line 99
protected array uniqueInertiaElements(array $elements)

Apply Inertia's last-write-wins ownership semantics to rendered elements.

Parameters

array $elements

Return Value

array

at line 136
protected array elements(HeadData $head, Request|null $request, TagRenderer $tags)

Render every builder in the resolved head.

Parameters

HeadData $head
Request|null $request
TagRenderer $tags

Return Value

array

at line 152
array toArray(HeadData $head, Request|null $request = null)

Render the resolved head as the array returned by Head::toArray().

Parameters

HeadData $head
Request|null $request

Return Value

array