Back to JsonDocument class

Method render

public string
render
(mixed $cache = false, mixed $params = array())
Render the document.
Parameters
  • bool $cache If true, cache the output
  • array $params Associative array of attributes
Returns
  • string The rendered data
Since
  • 1.7.0
Class: JsonDocument
Project: Joomla

Method render - Source code

/**
 * Render the document.
 *
 * @param   boolean  $cache   If true, cache the output
 * @param   array    $params  Associative array of attributes
 *
 * @return  string  The rendered data
 *
 * @since  1.7.0
 */
public function render($cache = false, $params = array())
{
    /** @var \Joomla\CMS\Application\CMSApplication $app */
    $app = CmsFactory::getApplication();
    $app->allowCache($cache);
    if ($this->_mime === 'application/json') {
        // Browser other than Internet Explorer < 10
        $app->setHeader('Content-Disposition', 'attachment; filename="' . $this->getName() . '.json"', true);
    }
    parent::render($cache, $params);
    return $this->getBuffer();
}