Back to WebApplication class

Method loadDocument

public \Joomla\CMS\Application\WebApplication
loadDocument
(\Joomla\CMS\Document\Document $document = null)
Allows the application to load a custom or default document.
Parameters
  • \Joomla\CMS\Document\Document $document An optional document object. If omitted, the factory document is created.
Returns
  • \Joomla\CMS\Application\WebApplication This method is chainable.
Since
  • 1.7.3

Method loadDocument - Source code

/**
 * Allows the application to load a custom or default document.
 *
 * The logic and options for creating this object are adequately generic for default cases
 * but for many applications it will make sense to override this method and create a document,
 * if required, based on more specific needs.
 *
 * @param   Document  $document  An optional document object. If omitted, the factory document is created.
 *
 * @return  WebApplication This method is chainable.
 *
 * @since   1.7.3
 */
public function loadDocument(Document $document = null)
{
    $this->document = $document ?? Factory::getDocument();
    return $this;
}