Back to AbstractRenderer class

Method loadDocument

protected \Joomla\CMS\Document\Document
loadDocument
()
Create the Document object for this renderer
Returns
  • \Joomla\CMS\Document\Document
Since
  • 4.0.0

Method loadDocument - Source code

/**
 * Create the Document object for this renderer
 *
 * @return  Document
 *
 * @since   4.0.0
 */
protected function loadDocument() : Document
{
    $attributes = ['charset' => 'utf-8', 'lineend' => 'unix', 'tab' => "\t", 'language' => 'en-GB', 'direction' => 'ltr'];
    // If there is a Language instance in Factory then let's pull the language and direction from its metadata
    if (Factory::$language) {
        $attributes['language'] = Factory::getLanguage()->getTag();
        $attributes['direction'] = Factory::getLanguage()->isRtl() ? 'rtl' : 'ltr';
    }
    return Factory::getContainer()->get(FactoryInterface::class)->createDocument($this->type, $attributes);
}