Back to HtmlDocument class

Method setBuffer

public \Joomla\CMS\Document\HtmlDocument
setBuffer
(mixed $content, mixed $options = array())
Set the contents a document includes
Parameters
  • string $content The content to be set in the buffer.
  • array $options Array of optional elements.
Returns
  • \Joomla\CMS\Document\HtmlDocument instance of $this to allow chaining
Since
  • 1.7.0
Class: HtmlDocument
Project: Joomla

Method setBuffer - Source code

/**
 * Set the contents a document includes
 *
 * @param   string  $content  The content to be set in the buffer.
 * @param   array   $options  Array of optional elements.
 *
 * @return  HtmlDocument instance of $this to allow chaining
 *
 * @since   1.7.0
 */
public function setBuffer($content, $options = array())
{
    // The following code is just for backward compatibility.
    if (\func_num_args() > 1 && !\is_array($options)) {
        $args = \func_get_args();
        $options = array();
        $options['type'] = $args[1];
        $options['name'] = $args[2] ?? null;
        $options['title'] = $args[3] ?? null;
    }
    parent::$_buffer[$options['type']][$options['name']][$options['title']] = $content;
    return $this;
}