Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3namespace MediaWiki\Hook;
4
5use MediaWiki\Linker\LinkTarget;
6use MediaWiki\Revision\RevisionRecord;
7
8/**
9 * @stable to implement
10 * @ingroup Hooks
11 */
12interface BeforeParserFetchTemplateRevisionRecordHook {
13    /**
14     * This hook is called before a template is fetched by Parser.
15     * It allows redirection of the title and/or revision id of the
16     * template.  For example: the template could be redirected to
17     * an appropriately localized version of the template; or the
18     * template fetch could be redirected to a 'stable revision' of
19     * the template.  If the returned RevisionRecord does not exist,
20     * its title will be added to the page dependencies and then this
21     * hook will be invoked again to resolve that title.  This allows
22     * for fallback chains (of limited length).
23     *
24     * @since 1.36
25     *
26     * @param ?LinkTarget $contextTitle The top-level page title, if any
27     * @param LinkTarget $title The template link (from the literal wikitext)
28     * @param bool &$skip Skip this template and link it?
29     * @param ?RevisionRecord &$revRecord The desired revision record
30     * @return bool|void True or no return value to continue or false to abort
31     */
32    public function onBeforeParserFetchTemplateRevisionRecord(
33        ?LinkTarget $contextTitle, LinkTarget $title,
34        bool &$skip, ?RevisionRecord &$revRecord
35    );
36}