ErrorDocument
Extends HtmlDocumentErrorDocument class, provides an easy interface to parse and display an HTML based error page
since |
1.7.0 |
---|---|
package |
Joomla CMS |
Methods
__construct
Class constructor
__construct(mixed||string|int options = []) :
since |
1.7.0 |
---|
Arguments
- options
array<string|int, mixed>
Associative array of attributes
Response
mixed
_fetchTemplate
Fetch the template, and initialise the params
_fetchTemplate(mixed||string|int params = []) : \Joomla\CMS\Document\HtmlDocument
since |
1.7.0 |
---|
Arguments
- params
array<string|int, mixed>
Parameters to determine the template
Response
HtmlDocument
instance of $this to allow chaining
_getLineEnd
Returns the lineEnd
_getLineEnd() :
since |
1.7.0 |
---|
Response
string
_getTab
Returns a string containing the unit for indenting HTML
_getTab() :
since |
1.7.0 |
---|
Response
string
_loadTemplate
Load a template file
_loadTemplate( directory, filename) :
since |
1.7.0 |
---|
Arguments
- directory
string
The name of the template- filename
string
The actual filename
Response
string
The contents of the template
_parseTemplate
Parse a document template
_parseTemplate() : \Joomla\CMS\Document\HtmlDocument
_renderTemplate
Render pre-parsed template
_renderTemplate() :
since |
1.7.0 |
---|
Response
string
rendered template
addCustomTag
Adds a custom HTML string to the head block
addCustomTag( html) : \Joomla\CMS\Document\HtmlDocument
since |
1.7.0 |
---|
Arguments
- html
string
The HTML to add to the head
Response
HtmlDocument
instance of $this to allow chaining
addFavicon
Adds a shortcut icon (favicon)
addFavicon( href, type = 'image/vnd.microsoft.icon', relation = 'icon') : \Joomla\CMS\Document\HtmlDocument
This adds a link to the icon shown in the favorites list or on the left of the url in the address bar. Some browsers display it on the tab, as well.
since |
1.7.0 |
---|
Arguments
- href
string
The link that is being related.- type
string
File type- relation
string
Relation of link
Response
HtmlDocument
instance of $this to allow chaining
addHeadLink
Adds <link>
tags to the head of the document
addHeadLink( href, relation, relType = 'rel', mixed||string|int attribs = []) : \Joomla\CMS\Document\HtmlDocument
$relType defaults to 'rel' as it is the most common relation type used.
('rev' refers to reverse relation, 'rel' indicates normal, forward relation.)
Typical tag: <link href="index.php" rel="Start">
since |
1.7.0 |
---|
Arguments
- href
string
The link that is being related.- relation
string
Relation of link.- relType
string
Relation type attribute. Either rel or rev (default: 'rel').- attribs
array<string|int, mixed>
Associative array of remaining attributes.
Response
HtmlDocument
instance of $this to allow chaining
addScript
Adds a linked script to the page
addScript( url, mixed||string|int options = [], mixed||string|int attribs = []) : \Joomla\CMS\Document\Document
since |
1.7.0 |
---|---|
deprecated |
4.3 will be removed in 6.0 Use WebAssetManager Example: $wa->registerAndUseScript(...); |
Arguments
- url
string
URL to the linked script.- options
array<string|int, mixed>
Array of options. Example: array('version' => 'auto', 'conditional' => 'lt IE 9', 'preload' => array('preload'))- attribs
array<string|int, mixed>
Array of attributes. Example: array('id' => 'scriptid', 'async' => 'async', 'data-test' => 1)
Response
Document
instance of $this to allow chaining
addScriptDeclaration
Adds a script to the page
addScriptDeclaration( content, type = 'text/javascript') : \Joomla\CMS\Document\Document
since |
1.7.0 |
---|---|
deprecated |
4.3 will be removed in 6.0 Use WebAssetManager Example: $wa->addInlineScript(...); |
Arguments
- content
string
Script- type
string
Scripting mime (defaults to 'text/javascript')
Response
Document
instance of $this to allow chaining
addScriptOptions
Add option for script
addScriptOptions( key, options, merge = true) : \Joomla\CMS\Document\Document
since |
3.5 |
---|
Arguments
- key
string
Name in Storage- options
mixed
Scrip options as array or string- merge
bool
Whether merge with existing (true) or replace (false)
Response
Document
instance of $this to allow chaining
addStyleDeclaration
Adds a stylesheet declaration to the page
addStyleDeclaration( content, type = 'text/css') : \Joomla\CMS\Document\Document
since |
1.7.0 |
---|---|
deprecated |
4.3 will be removed in 6.0 Use WebAssetManager Example: $wa->addInlineStyle(...); |
Arguments
- content
string
Style declarations- type
string
Type of stylesheet (defaults to 'text/css')
Response
Document
instance of $this to allow chaining
addStyleSheet
Adds a linked stylesheet to the page
addStyleSheet( url, mixed||string|int options = [], mixed||string|int attribs = []) : \Joomla\CMS\Document\Document
since |
1.7.0 |
---|---|
deprecated |
4.3 will be removed in 6.0 Use WebAssetManager Example: $wa->registerAndUseStyle(...); |
Arguments
- url
string
URL to the linked style sheet- options
array<string|int, mixed>
Array of options. Example: array('version' => 'auto', 'conditional' => 'lt IE 9', 'preload' => array('preload'))- attribs
array<string|int, mixed>
Array of attributes. Example: array('id' => 'stylesheet', 'data-test' => 1)
Response
Document
instance of $this to allow chaining
countMenuChildren
Count the number of child menu items of the current active menu item
countMenuChildren() :
since |
1.7.0 |
---|---|
deprecated |
4.4 will be removed in 6.0
Load the active menu item directly and count the children with the php count function
|
Response
int
Number of child menu items
countModules
Count the modules in the given position
countModules( positionName, withContentOnly = false) :
since |
1.7.0 |
---|
Arguments
- positionName
string
The position to use- withContentOnly
bool
Count only a modules which actually has a content
Response
int
Number of modules found
getBase
Return the base URI of the document.
getBase() :
since |
1.7.0 |
---|
Response
string
getBuffer
Get the contents of a document include
getBuffer( type = null, name = null, mixed||string|int attribs = []) : mixed|string
since |
1.7.0 |
---|
Arguments
- type
string
The type of renderer- name
string
The name of the element to render- attribs
array<string|int, mixed>
Associative array of remaining attributes.
Response
mixed|string
The output of the renderer
getCacheControllerFactory
Get the CacheControllerFactoryInterface.
getCacheControllerFactory() : \Joomla\CMS\Cache\CacheControllerFactoryInterface
getCharset
Returns the document charset encoding.
getCharset() :
since |
1.7.0 |
---|
Response
string
getDescription
Return the description of the document.
getDescription() :
since |
1.7.0 |
---|
Response
string
getDirection
Returns the document direction declaration.
getDirection() :
since |
1.7.0 |
---|
Response
string
getGenerator
Returns the document generator
getGenerator() :
since |
1.7.0 |
---|
Response
string
getHeadData
Get the HTML document head data
getHeadData() : mixed||string|int
since |
1.7.0 |
---|
Response
array<string|int, mixed>
The document head data in array form
getInstance
Returns the global Document object, only creating it if it doesn't already exist.
getInstance( type = 'html', mixed||string|int attributes = []) :
since |
1.7.0 |
---|---|
deprecated |
4.3 will be removed in 6.0 Use the \Joomla\CMS\Document\FactoryInterface instead Example: Factory::getApplication()->getDocument(); |
Arguments
- type
string
The document type to instantiate- attributes
array<string|int, mixed>
Array of attributes
Response
static
The document object.
getLanguage
Returns the document language.
getLanguage() :
since |
1.7.0 |
---|
Response
string
getLink
Returns the document base url
getLink() :
since |
1.7.0 |
---|
Response
string
getMediaVersion
Return the media version
getMediaVersion() :
since |
3.2 |
---|
Response
string
getMetaData
Gets a meta tag.
getMetaData( name, attribute = 'name') :
since |
1.7.0 |
---|
Arguments
- name
string
Name of the meta HTML tag- attribute
string
Attribute to use in the meta HTML tag
Response
string
getMimeEncoding
Return the document MIME encoding that is sent to the browser.
getMimeEncoding() :
since |
1.7.0 |
---|
Response
string
getModifiedDate
Returns the document modified date
getModifiedDate() : string|\Joomla\CMS\Date\Date
getPreloadManager
Return the preload manager
getPreloadManager() : \Joomla\CMS\Document\PreloadManagerInterface
getScriptOptions
Get script(s) options
getScriptOptions( key = null) : mixed||string|int
since |
3.5 |
---|
Arguments
- key
string
Name in Storage
Response
array<string|int, mixed>
Options for given $key, or all script options
getTitle
Return the title of the document.
getTitle() :
since |
1.7.0 |
---|
Response
string
getType
Returns the document type
getType() :
since |
1.7.0 |
---|
Response
string
getWebAssetManager
Return WebAsset manager
getWebAssetManager() : \Joomla\CMS\WebAsset\WebAssetManager
isHtml5
Returns whether the document is set up to be output as HTML5
isHtml5() :
since |
3.0.0 |
---|
Response
bool
true when HTML5 is used
loadRenderer
Load a renderer
loadRenderer( type) : \Joomla\CMS\Document\RendererInterface
since |
4.0.0 |
---|---|
throws |
|
Arguments
- type
string
The renderer type
Response
mergeHeadData
Merge the HTML document head data
mergeHeadData(mixed||string|int data) : \Joomla\CMS\Document\HtmlDocument
since |
1.7.0 |
---|
Arguments
- data
array<string|int, mixed>
The document head data in array form
Response
HtmlDocument
instance of $this to allow chaining
parse
Parses the template and populates the buffer
parse(mixed||string|int params = []) : \Joomla\CMS\Document\HtmlDocument
since |
1.7.0 |
---|
Arguments
- params
array<string|int, mixed>
Parameters for fetching the template
Response
HtmlDocument
instance of $this to allow chaining
preloadAssets
Generate the Link header for assets configured for preloading
preloadAssets() :
since |
4.0.0 |
---|
Response
void
render
Render the document
render( cache = false, mixed||string|int params = []) :
since |
1.7.0 |
---|
Arguments
- cache
bool
If true, cache the output- params
array<string|int, mixed>
Associative array of attributes
Response
string
The rendered data
renderBacktrace
Render the backtrace
renderBacktrace() :
since |
1.7.0 |
---|
Response
string
The contents of the backtrace
resetHeadData
Reset the HTML document head data
resetHeadData( types = null) : \Joomla\CMS\Document\HtmlDocument
since |
3.7.0 |
---|
Arguments
- types
mixed
type or types of the heads elements to reset
Response
HtmlDocument
instance of $this to allow chaining
resetHeadDatum
Reset a part the HTML document head data
resetHeadDatum( type) :
since |
3.7.0 |
---|
Arguments
- type
string
type of the heads elements to reset
Response
void
setBase
Sets the base URI of the document
setBase( base) : \Joomla\CMS\Document\Document
since |
1.7.0 |
---|
Arguments
- base
string
The base URI to be set
Response
Document
instance of $this to allow chaining
setBuffer
Set the contents a document includes
setBuffer( content, mixed||string|int options = []) : \Joomla\CMS\Document\HtmlDocument
since |
1.7.0 |
---|
Arguments
- content
string
The content to be set in the buffer.- options
array<string|int, mixed>
Array of optional elements.
Response
HtmlDocument
instance of $this to allow chaining
setCacheControllerFactory
Set the cache controller factory to use.
setCacheControllerFactory(\Joomla\CMS\Cache\CacheControllerFactoryInterface cacheControllerFactory = null) :
since |
4.2.0 |
---|
Arguments
- cacheControllerFactory
CacheControllerFactoryInterface
The cache controller factory to use.
Response
void
setCharset
Sets the document charset
setCharset( type = 'utf-8') : \Joomla\CMS\Document\Document
since |
1.7.0 |
---|
Arguments
- type
string
Charset encoding string
Response
Document
instance of $this to allow chaining
setDescription
Sets the description of the document
setDescription( description) : \Joomla\CMS\Document\Document
since |
1.7.0 |
---|
Arguments
- description
string
The description to set
Response
Document
instance of $this to allow chaining
setDirection
Sets the global document direction declaration. Default is left-to-right (ltr).
setDirection( dir = 'ltr') : \Joomla\CMS\Document\Document
since |
1.7.0 |
---|
Arguments
- dir
string
The language direction to be set
Response
Document
instance of $this to allow chaining
setError
Set error object
setError(\Throwable error) :
since |
1.7.0 |
---|
Arguments
- error
Throwable
Error object to set
Response
bool
True on success
setFactory
Set the factory instance
setFactory(\Joomla\CMS\Document\FactoryInterface factory) : \Joomla\CMS\Document\Document
setGenerator
Sets the document generator
setGenerator( generator) : \Joomla\CMS\Document\Document
since |
1.7.0 |
---|
Arguments
- generator
string
The generator to be set
Response
Document
instance of $this to allow chaining
setHeadData
Set the HTML document head data
setHeadData(mixed||string|int data) : \Joomla\CMS\Document\HtmlDocument|null
since |
1.7.0 |
---|
Arguments
- data
array<string|int, mixed>
The document head data in array form
Response
HtmlDocument|null
instance of $this to allow chaining or null for empty input data
setHtml5
Sets whether the document should be output as HTML5
setHtml5( state) :
since |
3.0.0 |
---|
Arguments
- state
bool
True when HTML5 should be output
Response
void
setLanguage
Sets the global document language declaration. Default is English (en-gb).
setLanguage( lang = 'en-gb') : \Joomla\CMS\Document\Document
since |
1.7.0 |
---|
Arguments
- lang
string
The language to be set
Response
Document
instance of $this to allow chaining
setLineEnd
Sets the line end style to Windows, Mac, Unix or a custom string.
setLineEnd( style) : \Joomla\CMS\Document\Document
since |
1.7.0 |
---|
Arguments
- style
string
"win", "mac", "unix" or custom string.
Response
Document
instance of $this to allow chaining
setLink
Sets the document link
setLink( url) : \Joomla\CMS\Document\Document
setMediaVersion
Set the assets version
setMediaVersion( mediaVersion) : \Joomla\CMS\Document\Document
since |
3.2 |
---|
Arguments
- mediaVersion
string
Media version to use
Response
Document
instance of $this to allow chaining
setMetaData
Sets or alters a meta tag.
setMetaData( name, content, attribute = 'name') : \Joomla\CMS\Document\Document
since |
1.7.0 |
---|
Arguments
- name
string
Name of the meta HTML tag- content
mixed
Value of the meta HTML tag as array or string- attribute
string
Attribute to use in the meta HTML tag
Response
Document
instance of $this to allow chaining
setMimeEncoding
Sets the document MIME encoding that is sent to the browser.
setMimeEncoding( type = 'text/html', sync = true) : \Joomla\CMS\Document\Document
This usually will be text/html because most browsers cannot yet accept the proper mime settings for XHTML: application/xhtml+xml and to a lesser extent application/xml and text/xml. See the W3C note ({@link https://www.w3.org/TR/xhtml-media-types/}) for more details.
since |
1.7.0 |
---|---|
link |
Arguments
- type
string
The document type to be sent- sync
bool
Should the type be synced with HTML?
Response
Document
instance of $this to allow chaining
setModifiedDate
Sets the document modified date
setModifiedDate(string|\Joomla\CMS\Date\Date date) : \Joomla\CMS\Document\Document
setPreloadManager
Set the preload manager
setPreloadManager(\Joomla\CMS\Document\PreloadManagerInterface preloadManager) : \Joomla\CMS\Document\Document
since |
4.0.0 |
---|
Arguments
- preloadManager
PreloadManagerInterface
The preload manager service
Response
Document
instance of $this to allow chaining
setTab
Sets the string used to indent HTML
setTab( string) : \Joomla\CMS\Document\Document
since |
1.7.0 |
---|
Arguments
- string
string
String used to indent ("\11", "\t", ' ', etc.).
Response
Document
instance of $this to allow chaining
setTitle
Sets the title of the document
setTitle( title) : \Joomla\CMS\Document\Document
since |
1.7.0 |
---|
Arguments
- title
string
The title to be set
Response
Document
instance of $this to allow chaining
setType
Set the document type
setType( type) : \Joomla\CMS\Document\Document
since |
1.7.0 |
---|
Arguments
- type
string
Type document is to set to
Response
Document
instance of $this to allow chaining
setWebAssetManager
Set WebAsset manager
setWebAssetManager(\Joomla\CMS\WebAsset\WebAssetManager webAsset) : \Joomla\CMS\Document\Document
Properties
title
Document title
since |
1.7.0 |
---|
Type(s)
string
description
Document description
since |
1.7.0 |
---|
Type(s)
string
link
Document full URL
since |
1.7.0 |
---|
Type(s)
string
base
Document base URL
since |
1.7.0 |
---|
Type(s)
string
language
Contains the document language setting
since |
1.7.0 |
---|
Type(s)
string
direction
Contains the document direction setting
since |
1.7.0 |
---|
Type(s)
string
_generator
Document generator
since |
1.7.0 |
---|
Type(s)
string
_tab
Tab string
since |
1.7.0 |
---|
Type(s)
string
_lineEnd
Contains the line end string
since |
1.7.0 |
---|
Type(s)
string
_charset
Contains the character encoding string
since |
1.7.0 |
---|
Type(s)
string
_mime
Document mime type
since |
1.7.0 |
---|
Type(s)
string
_namespace
Document namespace
since |
1.7.0 |
---|
Type(s)
string
_profile
Document profile
since |
1.7.0 |
---|
Type(s)
string
_scripts
Array of linked scripts
since |
1.7.0 |
---|---|
deprecated |
4.3 will be removed in 6.0 Use WebAssetManager |
Type(s)
array<string|int, mixed>
_script
Array of scripts placed in the header
since |
1.7.0 |
---|---|
deprecated |
4.3 will be removed in 6.0 Use WebAssetManager |
Type(s)
array<string|int, mixed>
scriptOptions
Array of scripts options
Type(s)
array<string|int, mixed>
_styleSheets
Array of linked style sheets
since |
1.7.0 |
---|---|
deprecated |
4.3 will be removed in 6.0 Use WebAssetManager |
Type(s)
array<string|int, mixed>
_style
Array of included style declarations
since |
1.7.0 |
---|---|
deprecated |
4.3 will be removed in 6.0 Use WebAssetManager |
Type(s)
array<string|int, mixed>
_metaTags
Array of meta tags
since |
1.7.0 |
---|
Type(s)
array<string|int, mixed>
_engine
The rendering engine
since |
1.7.0 |
---|
Type(s)
object
_type
The document type
since |
1.7.0 |
---|
Type(s)
string
_buffer
Array of buffered output
since |
1.7.0 |
---|
Type(s)
mixed
instances
Document instances container.
since |
1.7.3 |
---|
Type(s)
array<string|int, mixed>
mediaVersion
Media version added to assets
since |
3.2 |
---|
Type(s)
string
preloadTypes
The supported preload types
since |
4.0.0 |
---|
Type(s)
array<string|int, mixed>
cacheControllerFactory
CacheControllerFactoryInterface
_links
Array of Header <link>
tags
since |
1.7.0 |
---|
Type(s)
array<string|int, mixed>
_custom
Array of custom tags
since |
1.7.0 |
---|
Type(s)
array<string|int, mixed>
template
Name of the template
since |
1.7.0 |
---|
Type(s)
string
baseurl
Base url
since |
1.7.0 |
---|
Type(s)
string
params
Array of template parameters
since |
1.7.0 |
---|
Type(s)
array<string|int, mixed>
_file
File name
since |
1.7.0 |
---|
Type(s)
array<string|int, mixed>
cspNonce
Script nonce (string if set, null otherwise)
since |
4.0.0 |
---|
Type(s)
string|null
_template
String holding parsed template
since |
1.7.0 |
---|
Type(s)
string
_template_tags
Array of parsed template JDoc tags
since |
1.7.0 |
---|
Type(s)
array<string|int, mixed>
_caching
Integer with caching setting
since |
1.7.0 |
---|
Type(s)
int
html5
Set to true when the document should be output as HTML5
since |
4.0.0 |
---|
Type(s)
bool
debug
Flag if debug mode has been enabled
since |
1.7.0 |
---|
Type(s)
bool
error
Error Object
since |
1.7.0 |
---|
Type(s)
Throwable
_error
Error Object
since |
1.7.0 |
---|
Type(s)
Throwable