trait ManagesLayouts

Properties

protected array $sections

All of the finished, captured sections.

protected array $sectionStack

The stack of in-progress sections.

static protected string $parentPlaceholder

The parent placeholder for the request.

Methods

void
startSection(string $section, string|null $content = null)

Start injecting content into a section.

void
inject(string $section, string $content)

Inject inline content into a section.

string
yieldSection()

Stop injecting content into a section and return its contents.

string
stopSection(bool $overwrite = false)

Stop injecting content into a section.

string
appendSection()

Stop injecting content into a section and append it.

void
extendSection(string $section, string $content)

Append content to a given section.

string
yieldContent(string $section, string $default = '')

Get the string contents of a section.

static string
parentPlaceholder(string $section = '')

Get the parent placeholder for the current request.

bool
hasSection(string $name)

Check if section exists.

mixed
getSection(string $name, string $default = null)

Get the contents of a section.

array
getSections()

Get the entire array of sections.

void
flushSections()

Flush all of the sections.

Details

at line 38
void startSection(string $section, string|null $content = null)

Start injecting content into a section.

Parameters

string $section
string|null $content

Return Value

void

at line 56
void inject(string $section, string $content)

Inject inline content into a section.

Parameters

string $section
string $content

Return Value

void

at line 66
string yieldSection()

Stop injecting content into a section and return its contents.

Return Value

string

at line 82
string stopSection(bool $overwrite = false)

Stop injecting content into a section.

Parameters

bool $overwrite

Return Value

string

Exceptions

InvalidArgumentException

at line 105
string appendSection()

Stop injecting content into a section and append it.

Return Value

string

Exceptions

InvalidArgumentException

at line 129
protected void extendSection(string $section, string $content)

Append content to a given section.

Parameters

string $section
string $content

Return Value

void

at line 145
string yieldContent(string $section, string $default = '')

Get the string contents of a section.

Parameters

string $section
string $default

Return Value

string

at line 166
static string parentPlaceholder(string $section = '')

Get the parent placeholder for the current request.

Parameters

string $section

Return Value

string

at line 181
bool hasSection(string $name)

Check if section exists.

Parameters

string $name

Return Value

bool

at line 193
mixed getSection(string $name, string $default = null)

Get the contents of a section.

Parameters

string $name
string $default

Return Value

mixed

at line 203
array getSections()

Get the entire array of sections.

Return Value

array

at line 213
void flushSections()

Flush all of the sections.

Return Value

void