trait ManagesComponents (View source)

Properties

protected array $componentStack

The components being rendered.

protected array $componentData

The original data passed to the component.

protected array $currentComponentData

The component data for the component that is currently being rendered.

protected array $slots

The slot contents for the component.

protected array $slotStack

The names of the slots being rendered.

Methods

void
startComponent(View|Htmlable|Closure|string $view, array $data = [])

Start a component rendering process.

void
startComponentFirst(array $names, array $data = [])

Get the first view that actually exists from the given list, and start a component.

string
renderComponent()

Render the current component.

array
componentData()

Get the data for the given component.

mixed|null
getConsumableComponentData(string $key, mixed $default = null)

Get an item from the component data that exists above the current component.

void
slot(string $name, string|null $content = null, array $attributes = [])

Start the slot rendering process.

void
endSlot()

Save the slot content for rendering.

int
currentComponent()

Get the index for the current component.

void
flushComponents()

Flush all of the component state.

Details

void startComponent(View|Htmlable|Closure|string $view, array $data = [])

Start a component rendering process.

Parameters

View|Htmlable|Closure|string $view
array $data

Return Value

void

void startComponentFirst(array $names, array $data = [])

Get the first view that actually exists from the given list, and start a component.

Parameters

array $names
array $data

Return Value

void

string renderComponent()

Render the current component.

Return Value

string

protected array componentData()

Get the data for the given component.

Return Value

array

mixed|null getConsumableComponentData(string $key, mixed $default = null)

Get an item from the component data that exists above the current component.

Parameters

string $key
mixed $default

Return Value

mixed|null

void slot(string $name, string|null $content = null, array $attributes = [])

Start the slot rendering process.

Parameters

string $name
string|null $content
array $attributes

Return Value

void

void endSlot()

Save the slot content for rendering.

Return Value

void

protected int currentComponent()

Get the index for the current component.

Return Value

int

protected void flushComponents()

Flush all of the component state.

Return Value

void