Back to Factory class

Method getDocument

public static \Joomla\CMS\Document\Document
getDocument
()
Get 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 getDocument - Source code

/**
 * Get a document object.
 *
 * Returns the global {@link \Joomla\CMS\Document\Document} object, only creating it if it doesn't already exist.
 *
 * @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()
 */
public static function getDocument()
{
    @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);
    if (!self::$document) {
        self::$document = self::createDocument();
    }
    return self::$document;
}
OSZAR »