trait ManagesComponents

Properties

protected array $componentStack

The components being rendered.

protected array $componentData

The original data passed to the component.

protected array $slots

The slot contents for the component.

protected array $slotStack

The names of the slots being rendered.

Methods

void
startComponent(string $name, array $data = [])

Start a component rendering process.

string
renderComponent()

Render the current component.

array
componentData(string $name)

Get the data for the given component.

void
slot(string $name, string|null $content = null)

Start the slot rendering process.

void
endSlot()

Save the slot content for rendering.

int
currentComponent()

Get the index for the current component.

Details

at line 44
void startComponent(string $name, array $data = [])

Start a component rendering process.

Parameters

string $name
array $data

Return Value

void

at line 60
string renderComponent()

Render the current component.

Return Value

string

at line 73
protected array componentData(string $name)

Get the data for the given component.

Parameters

string $name

Return Value

array

at line 89
void slot(string $name, string|null $content = null)

Start the slot rendering process.

Parameters

string $name
string|null $content

Return Value

void

at line 107
void endSlot()

Save the slot content for rendering.

Return Value

void

at line 124
protected int currentComponent()

Get the index for the current component.

Return Value

int