trait ManagesLayouts

Constants

protected SECTIONS_CONTEXT_KEY

Context key for finished, captured sections.

protected SECTION_STACK_CONTEXT_KEY

Context key for the stack of in-progress sections.

Properties

static protected string|null $parentPlaceholderSalt

The parent placeholder salt for the worker.

Methods

void
startSection(string $section, string|View|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|View $default = '')

Get the string contents of a section.

static string
parentPlaceholder(string $section = '')

Get the parent placeholder for the given section.

static string
parentPlaceholderSalt()

Get the parent placeholder salt.

bool
hasSection(string $name)

Check if section exists.

bool
sectionMissing(string $name)

Check if section does not exist.

mixed
getSection(string $name, string|null $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 32
void startSection(string $section, string|View|null $content = null)

Start injecting content into a section.

Parameters

string $section
string|View|null $content

Return Value

void

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

Inject inline content into a section.

Parameters

string $section
string $content

Return Value

void

at line 57
string yieldSection()

Stop injecting content into a section and return its contents.

Return Value

string

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

Stop injecting content into a section.

Parameters

bool $overwrite

Return Value

string

Exceptions

InvalidArgumentException

at line 100
string appendSection()

Stop injecting content into a section and append it.

Return Value

string

Exceptions

InvalidArgumentException

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

Append content to a given section.

Parameters

string $section
string $content

Return Value

void

at line 140
string yieldContent(string $section, string|View $default = '')

Get the string contents of a section.

Parameters

string $section
string|View $default

Return Value

string

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

Get the parent placeholder for the given section.

Parameters

string $section

Return Value

string

at line 168
static protected string parentPlaceholderSalt()

Get the parent placeholder salt.

Return Value

string

at line 176
bool hasSection(string $name)

Check if section exists.

Parameters

string $name

Return Value

bool

at line 185
bool sectionMissing(string $name)

Check if section does not exist.

Parameters

string $name

Return Value

bool

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

Get the contents of a section.

Parameters

string $name
string|null $default

Return Value

mixed

at line 202
array getSections()

Get the entire array of sections.

Return Value

array

at line 210
void flushSections()

Flush all of the sections.

Return Value

void