MediaWiki master
MediaWiki\Linker\Hook\LinkerMakeExternalLinkWithContextHook Interface Reference

This is a hook handler interface, see docs/Hooks.md. More...

Inherited by MediaWiki\HookContainer\HookRunner.

Public Member Functions

 onLinkerMakeExternalLinkWithContext (?string &$url, string &$text, array &$attribs, string $linkType, LinkTarget $contextTitle)
 This hook is called at the end of Linker::makeExternalLink() just before the return.
 

Detailed Description

This is a hook handler interface, see docs/Hooks.md.

Use the hook name "LinkerMakeExternalLinkWithContext" to register handlers implementing this interface.

Stability: stable
to implement

Definition at line 15 of file LinkerMakeExternalLinkWithContextHook.php.

Member Function Documentation

◆ onLinkerMakeExternalLinkWithContext()

MediaWiki\Linker\Hook\LinkerMakeExternalLinkWithContextHook::onLinkerMakeExternalLinkWithContext ( ?string & $url,
string & $text,
array & $attribs,
string $linkType,
LinkTarget $contextTitle )

This hook is called at the end of Linker::makeExternalLink() just before the return.

It is a more modern version of LinkerMakeExternalLink, which provides a context title and reflects modern practice in not allowing direct mutation of the link HTML.

Parsoid allows rewriting or blocking (setting to null) the $url, and adding class, title, and rel attributes. Setting $url to null will block the link: no href attribute will be present on the tag.

Since
1.46
Parameters
?string&$urlLink URL
string&$textLink text
string[]&$attribsAttributes to be applied
string$linkTypeExternal link type
LinkTarget$contextTitle
Returns
bool|void True or no return value to continue or false to abort

The documentation for this interface was generated from the following file: