| 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 "HtmlPageLinkRendererEnd" to register handlers implementing this interface. |
| 12 | * |
| 13 | * @stable to implement |
| 14 | * @ingroup Hooks |
| 15 | */ |
| 16 | interface HtmlPageLinkRendererEndHook { |
| 17 | /** |
| 18 | * This hook is called when generating internal and interwiki links in LinkRenderer, |
| 19 | * just before the function returns a value. |
| 20 | * |
| 21 | * @since 1.35 |
| 22 | * |
| 23 | * @param LinkRenderer $linkRenderer |
| 24 | * @param LinkTarget $target LinkTarget object that the link is pointing to |
| 25 | * @param bool $isKnown Whether the page is known or not |
| 26 | * @param string|HtmlArmor &$text Contents that the `<a>` tag should have; either a plain, |
| 27 | * unescaped string or an HtmlArmor object |
| 28 | * @param string[] &$attribs Final HTML attributes of the `<a>` tag, after processing, in |
| 29 | * associative array form |
| 30 | * @param string &$ret Value to return if your hook returns false |
| 31 | * @return bool|void True or no return value to continue or false to abort. If you return |
| 32 | * true, an `<a>` element with HTML attributes $attribs and contents $html will be |
| 33 | * returned. If you return false, $ret will be returned. |
| 34 | */ |
| 35 | public function onHtmlPageLinkRendererEnd( $linkRenderer, $target, $isKnown, |
| 36 | &$text, &$attribs, &$ret |
| 37 | ); |
| 38 | } |