Back to Factory class

Method createDocument

protected static \Joomla\CMS\Document\Document
createDocument
()
Create a document object
Returns
  • \Joomla\CMS\Document\Document object
Since
  • 1.7.0
Deprecated
  • 5.0
-
  • \Joomla\CMS\Document\Document
Class: Factory
Project: Joomla

Method createDocument - Source code

/**
 * Create a document object
 *
 * @return  Document object
 *
 * @see         Document
 * @since       1.7.0
 * @deprecated  5.0  Load the document service from the dependency injection container or via $app->getDocument()
 */
protected static function createDocument()
{
    @trigger_error(sprintf('%1$s() is deprecated. Load the document from the dependency injection container or via %2$s::getApplication()->getDocument().', __METHOD__, __CLASS__), E_USER_DEPRECATED);
    $lang = self::getLanguage();
    $input = self::getApplication()->input;
    $type = $input->get('format', 'html', 'cmd');
    $version = new Version();
    $attributes = array('charset' => 'utf-8', 'lineend' => 'unix', 'tab' => "\t", 'language' => $lang->getTag(), 'direction' => $lang->isRtl() ? 'rtl' : 'ltr', 'mediaversion' => $version->getMediaVersion());
    return self::getContainer()->get(FactoryInterface::class)->createDocument($type, $attributes);
}