class SlotsHelper extends Helper
SlotsHelper manages template slots.
protected | $charset | from Helper | |
protected | $slots | ||
protected | $openSlots |
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. |
Sets the default charset.
string | $charset | The charset |
Gets the default charset.
string | The default charset |
Starts a new slot.
This method starts an output buffer that will be closed when the stop() method is called.
string | $name | The slot name |
InvalidArgumentException | if a slot with the same name is already started |
Stops a slot.
LogicException | if no slot has been started |
Returns true if the slot exists.
string | $name | The slot name |
bool |
Gets the slot value.
string | $name | The slot name |
bool|string | $default | The default slot content |
string | The slot content |
Sets a slot value.
string | $name | The slot name |
string | $content | The slot content |
Outputs a slot.
string | $name | The slot name |
bool|string | $default | The default slot content |
bool | true if the slot is defined or if a default content has been provided, false otherwise |
Returns the canonical name of this helper.
string | The canonical name |
© 2004–2017 Fabien Potencier
Licensed under the MIT License.
https://api.symfony.com/4.1/Symfony/Component/Templating/Helper/SlotsHelper.html