October\Rain\Html\BlockBuilder

Source: ~/vendor/october/rain/src/Html/BlockBuilder.php

Block manager

Protected properties

protected $blockStack

protected $blocks

Public methods

public void append(string $name, string $content)

Appends a content of the layout block.

Parameters
  • string $name - Specifies the block name.
  • string $content - Specifies the block content.

public void endBlock(boolean $append=false)

Closes the layout block.

Parameters
  • boolean $append - Indicates that the new content should be appended to the existing block content.

public void endPut(boolean $append=false)

Helper for endBlock and also clears the output buffer.

Parameters
  • boolean $append - Indicates that the new content should be appended to the existing block content.

public string get(string $name, string $default=NULL)

Returns the layout block contents but not deletes the block from memory.

Parameters
  • string $name - Specifies the block name.
  • string $default - Specifies a default block value to use if the block requested is not exists.

public string placeholder(string $name, string $default=NULL)

Returns the layout block contents and deletes the block from memory.

Parameters
  • string $name - Specifies the block name.
  • string $default - Specifies a default block value to use if the block requested is not exists.

public void put(string $name)

Helper for startBlock

Parameters
  • string $name - Specifies the block name.

public void reset()

Clears all the registered blocks.

public void set(string $name, string $content)

Sets a content of the layout block.

Parameters
  • string $name - Specifies the block name.
  • string $content - Specifies the block content.

public void startBlock(string $name)

Begins the layout block.

Parameters
  • string $name - Specifies the block name.