| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Linker\Hook; |
| 4 | |
| 5 | use HtmlArmor; |
| 6 | use MediaWiki\Linker\LinkRenderer; |
| 7 | use MediaWiki\Linker\LinkTarget; |
| 8 | |
| 9 | /** |
| 10 | * This is a hook handler interface, see docs/Hooks.md. |
| 11 | * Use the hook name "HtmlPageLinkRendererBegin" to register handlers implementing this interface. |
| 12 | * |
| 13 | * @stable to implement |
| 14 | * @ingroup Hooks |
| 15 | */ |
| 16 | interface HtmlPageLinkRendererBeginHook { |
| 17 | /** |
| 18 | * This hook is called when generating internal and interwiki links in |
| 19 | * LinkRenderer, before processing starts. |
| 20 | * |
| 21 | * @since 1.35 |
| 22 | * |
| 23 | * @param LinkRenderer $linkRenderer |
| 24 | * @param LinkTarget $target LinkTarget that the link is pointing to |
| 25 | * @param string|HtmlArmor|null &$text Contents that the `<a>` tag should |
| 26 | * have; either a plain, unescaped string or an HtmlArmor object; null |
| 27 | * means "default" |
| 28 | * @param string[] &$customAttribs HTML attributes that the `<a>` tag should have, in |
| 29 | * associative array form, with keys and values unescaped. Should be merged |
| 30 | * with default values, with a value of false meaning to suppress the |
| 31 | * attribute. |
| 32 | * @param string[] &$query Query string to add to the generated URL (the bit after the "?"), |
| 33 | * in associative array form, with keys and values unescaped. |
| 34 | * @param string &$ret Value to return if your hook returns false |
| 35 | * @return bool|void True or no return value to continue, or false to skip default |
| 36 | * processing and return $ret |
| 37 | */ |
| 38 | public function onHtmlPageLinkRendererBegin( $linkRenderer, $target, &$text, |
| 39 | &$customAttribs, &$query, &$ret |
| 40 | ); |
| 41 | } |