Manual:Hooks/ParserFetchTemplateData
ParserFetchTemplateData | |
---|---|
Available from versionĀ ??? (Gerrit change 494817) Fetches template data for an array of template titles | |
Define function: | public static function onParserFetchTemplateData( array $titles, array &$ret ) { ... }
|
Attach hook: | In extension.json:
{
"Hooks": {
"ParserFetchTemplateData": "MyExtensionHooks::onParserFetchTemplateData"
}
}
|
Called from: | File(s): ../../../../services/parsoid/+/refs/heads/master/extension/src/Config/DataAccess.php Function(s): fetchTemplateData |
Interface: | ParserFetchTemplateDataHook.php |
For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:ParserFetchTemplateData extensions.
ParametersEdit
$titles
: 1-dimensional array of strings, representing template titles&$templateData
: array map (contains key-value pairs) passed by reference, which can be modified by extensions to send their own template data
Use casesEdit
Currently, TemplateData uses this extension. TemplateData will add each template title to the $templateData
map, and will assign one of the following values:
- If a title is invalid title or is an invalid redirect title, gives a
null
value - If a title doesn't exist, will assign it a
'missing'
key assigned withtrue
- If a title has invalid data from the database, or does not have a
'templatedata'
property in the page_props table, assign it as:(object)[ "notemplatedata" => true ]
NotesEdit
- This hook currently lives inside the PHP Parsoid service.
- This hook was originally named "ParsoidFetchTemplateData" in Gerrit change 494817, and renamed to "ParserFetchTemplateData" in Gerrit change 552666.