Renderer for admin templates.

Note that due to a lack of late static binding support, all static properties and any method that deals with those properties (via "self", regardless of whether it's static or not) must be (re)defined in child classes!

package XenForo_Core

 Methods

Constructor

__construct(string $templateName, array $params) 
Inherited
inherited_from \XenForo_Template_Abstract::__construct()

Parameters

$templateName

string

Template name

$params

array

Key-value parameters

Implicit string cast renders the template.

__toString() : string
Inherited
inherited_from \XenForo_Template_Abstract::__toString()

Returns

string

Adds required external for this type of template to be output later.

addRequiredExternal(string $type, string $requirement) 
Inherited
inherited_from \XenForo_Template_Abstract::addRequiredExternal()

Parameters

$type

string

Type of requirement

$requirement

string

Value for requirement

Calls the specified template hook event.

callTemplateHook(string $name, string $contents, array $params) : string
Inherited

Params passed by template explicitly will respect mappings and greater context. Raw params are still available via the template object.

inherited_from \XenForo_Template_Abstract::callTemplateHook()

Parameters

$name

string

Name of the hook

$contents

string

Contents of the hook; may be empty

$params

array

List of params to pass specifically; these will respect mappings.

Returns

stringNew version of the contents (could be modified)

Creates a new template object of the current type.

create(string $templateName, array $params) : \XenForo_Template_Abstract
Inherited

Mainly helpful if an event only has the current template object in scope.

inherited_from \XenForo_Template_Abstract::create()

Parameters

$templateName

string

$params

array

Returns

Gets extra container data.

getExtraContainerData() : array
Static

Returns

array

Get a single template parameter.

getParam(string $key) : mixed
Inherited
inherited_from \XenForo_Template_Abstract::getParam()

Parameters

$key

string

Returns

mixedNull if not found.

Get all template parameters.

getParams() : array
Inherited
inherited_from \XenForo_Template_Abstract::getParams()

Returns

array

Gets the required CSS as an HTML tag.

getRequiredCssAsHtml(string $requirement) : string
Inherited

Expected arg is simple a URL.

inherited_from \XenForo_Template_Abstract::getRequiredCssAsHtml()

Parameters

$requirement

string

Returns

string

Gets the URL to fetch the list of required CSS templates.

getRequiredCssUrl(array $requirements) : string

Requirements should be a list of CSS templates, not including the trailing ".css".

Parameters

$requirements

array

Returns

string

Gets required externals in a structured way.

getRequiredExternals(string $type) : array
Inherited

Values will be returned as a list of URLs.

inherited_from \XenForo_Template_Abstract::getRequiredExternals()

Parameters

$type

string

Returns

arrayList of URLs

Gets required external resources as HTML for use in a template directly.

getRequiredExternalsAsHtml(string $type) : string
Inherited
inherited_from \XenForo_Template_Abstract::getRequiredExternalsAsHtml()

Parameters

$type

string

Type of requirement to fetch

Returns

stringRequirements as HTML

getRequiredExternalsAsJson()

getRequiredExternalsAsJson() 
Inherited
inherited_from \XenForo_Template_Abstract::getRequiredExternalsAsJson()

Gets the list of required JavaScript files as HTML script tags.

getRequiredJavaScriptAsHtml(array $requirements) : string
Inherited
inherited_from \XenForo_Template_Abstract::getRequiredJavaScriptAsHtml()

Parameters

$requirements

array

Array of paths to JS files.

Returns

string

getTemplateName()

getTemplateName() : string
Inherited
inherited_from \XenForo_Template_Abstract::getTemplateName()

Returns

string

Helper function get the list of templates that are waiting to be loaded.

getToLoadList() : array

Returns

array

Error handler that traps errors in templates.

handleTemplateError(integer $errorType, string $errorString, string $file, integer $line) 
Inherited
inherited_from \XenForo_Template_Abstract::handleTemplateError()

Parameters

$errorType

integer

Type of error (one of the E_* constants)

$errorString

string

$file

string

$line

integer

Specify a template that needs to be preloaded for use later.

preloadTemplate(string $templateName) 
Static

This is useful if you think a render is going to be called before the template you require is to be used.

Parameters

$templateName

string

Template to preload

Renders the specified template and returns the output.

render() : string
Inherited
inherited_from \XenForo_Template_Abstract::render()

Returns

string

Resets the template system state.

reset() 
Static

Sets the language ID that templates will be retrieved from.

setLanguageId(integer $languageId) 
InheritedStatic
inherited_from \XenForo_Template_Abstract::setLanguageId()

Parameters

$languageId

integer

Add a single param to the template.

setParam(string $key, $value) 
Inherited

Overwrites parameters with the same name.

inherited_from \XenForo_Template_Abstract::setParam()

Parameters

$key

string

$value

Add an array of params to the template.

setParams(array $params) 
Inherited

Overwrites parameters with the same name.

inherited_from \XenForo_Template_Abstract::setParams()

Parameters

$params

array

Manually sets a template.

setTemplate(string $templateName, string $templateValue) 
Static

This is primarily useful for testing.

Parameters

$templateName

string

Name of the template

$templateValue

string

Value for the template

Gets the list of required external resources.

_getRequiredExternals() : array

Returns

array

Goes to the data source to load the list of templates.

_getTemplatesFromDataSource(array $templateList) : array

Parameters

$templateList

array

Template list

Returns

arrayKey-value pairs of template titles/compiled templates

Load the named template.

_loadTemplate(string $templateName) : string
Inherited
inherited_from \XenForo_Template_Abstract::_loadTemplate()

Parameters

$templateName

string

Template name

Returns

stringCompiled version of the template

Loads the file path where a template is located in the file system, if templates are being stored in the file system.

_loadTemplateFilePath(string $templateName) 

Parameters

$templateName

string

Template name

Loads a template out of the local template cache.

_loadTemplateFromCache(string $templateName) : string

If the template does not exist, it will be set to an empty string. This will be overwritten if the template is loaded from the data source.

Parameters

$templateName

string

Template name

Returns

stringCompiled template

Bulk load all templates that are required.

_loadTemplates() 
Inherited
inherited_from \XenForo_Template_Abstract::_loadTemplates()

Merges in extra container data from the template render.

_mergeExtraContainerData(array $extraData) 

Parameters

$extraData

array

Merges key-value pairs of template names/compiled templates into the local template cache.

_mergeIntoTemplateCache(array $templates) 

Parameters

$templates

array

Templates (key: name, value: compiled output)

Non-static method for pre-loading a template.

_preloadTemplate(string $templateName) 

Parameters

$templateName

string

Template name

_processJsUrls()

_processJsUrls(array $jsFiles) 
Inherited
inherited_from \XenForo_Template_Abstract::_processJsUrls()

Parameters

$jsFiles

Internal template rendering.

_renderInternal(string $__template, array $__extraData) : string
Inherited
inherited_from \XenForo_Template_Abstract::_renderInternal()

Parameters

$__template

string

Template text or name of template file

$__extraData

array

Returned extra data from the render

Returns

stringRendered template

Resets the to load list to empty.

_resetToLoadList() 

Sets the list of required external resources.

_setRequiredExternals(array $required) 

Parameters

$required

array

Determines whether we are using templates in the file system.

_usingTemplateFiles() : boolean

Returns

boolean

 Properties

 

$_extraData : array
 

$_filePath : string

All child classes must redefine this property!

 

$_languageId : integer
Inherited
inherited_from \XenForo_Template_Abstract::$$_languageId
 

$_params : array
Inherited
inherited_from \XenForo_Template_Abstract::$$_params
 

$_required : array

All child classes must redefine this property!

 

$_templateCache : array

Key is the template name; value is the compiled template.

 

$_templateErrors : array
Inherited
inherited_from \XenForo_Template_Abstract::$$_templateErrors
 

$_templateName : string
Inherited
inherited_from \XenForo_Template_Abstract::$$_templateName
 

$_toLoad : array

Key is the template name.