| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Hook; |
| 4 | |
| 5 | /** |
| 6 | * This is a hook handler interface, see docs/Hooks.md. |
| 7 | * Use the hook name "ParserFetchTemplateData" to register handlers |
| 8 | * implementing this interface. |
| 9 | * |
| 10 | * @unstable |
| 11 | * @ingroup Hooks |
| 12 | */ |
| 13 | interface ParserFetchTemplateDataHook { |
| 14 | /** |
| 15 | * This hook allows Parsoid to fetch additional serialization information |
| 16 | * about a Template, including the type of its arguments, whether they |
| 17 | * should be serialized as inline or block style wikitext, etc. |
| 18 | * See [[Extension:TemplateData]] for more information. |
| 19 | * |
| 20 | * @param string[] $titles An array of template names |
| 21 | * @param array<string,object> &$tplData The hook will create an |
| 22 | * associative array, mapping each given |
| 23 | * template name to an object representing the TemplateData for that |
| 24 | * template, or special objects if the title doesn't exist, is missing |
| 25 | * TemplateData, or has malformed TemplateData. |
| 26 | * @return bool Typically returns true, to allow all registered hooks a |
| 27 | * chance to fill in template data. |
| 28 | * |
| 29 | * @unstable temporary hook; will be cleaned up before it is made stable |
| 30 | * @since 1.39 |
| 31 | */ |
| 32 | public function onParserFetchTemplateData( |
| 33 | array $titles, |
| 34 | array &$tplData |
| 35 | ): bool; |
| 36 | } |