class SlotsHelper extends Helper

SlotsHelper manages template slots.

Methods

setCharset(string $charset)

Sets the default charset.

from Helper
string
getCharset()

Gets the default charset.

from Helper
start(string $name)

Starts a new slot.

stop()

Stops a slot.

bool
has(string $name)

Returns true if the slot exists.

string
get(string $name, bool|string $default = false)

Gets the slot value.

set(string $name, string $content)

Sets a slot value.

bool
output(string $name, bool|string $default = false)

Outputs a slot.

string
getName()

Returns the canonical name of this helper.

Details

in Helper at line line 31
setCharset(string $charset)

Sets the default charset.

Parameters

string $charset The charset

in Helper at line line 41
string getCharset()

Gets the default charset.

Return Value

string The default charset

at line line 34
start(string $name)

Starts a new slot.

This method starts an output buffer that will be closed when the stop() method is called.

Parameters

string $name The slot name

Exceptions

InvalidArgumentException if a slot with the same name is already started

at line line 52
stop()

Stops a slot.

Exceptions

LogicException if no slot has been started

at line line 70
bool has(string $name)

Returns true if the slot exists.

Parameters

string $name The slot name

Return Value

bool

at line line 83
string get(string $name, bool|string $default = false)

Gets the slot value.

Parameters

string $name The slot name
bool|string $default The default slot content

Return Value

string The slot content

at line line 94
set(string $name, string $content)

Sets a slot value.

Parameters

string $name The slot name
string $content The slot content

at line line 107
bool output(string $name, bool|string $default = false)

Outputs a slot.

Parameters

string $name The slot name
bool|string $default The default slot content

Return Value

bool true if the slot is defined or if a default content has been provided, false otherwise

at line line 129
string getName()

Returns the canonical name of this helper.

Return Value

string The canonical name