diff --git a/docs/hooks.txt b/docs/hooks.txt index 0b072f29c9d..e91f43721b6 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -2186,6 +2186,14 @@ $title : Current Title object being displayed in search results. 'SearchableNamespaces': An option to modify which namespaces are searchable. &$arr : Array of namespaces ($nsId => $name) which will be used. +'SelfLinkBegin': Called before a link to the current article is displayed to +allow the display of the link to be customized. +$nt: the Title object +&$html: html to display for the link +&$trail: optional text to display before $html +&$prefix: optional text to display after $html +&$ret: the value to return if your hook returns false + 'SetupAfterCache': Called in Setup.php, after cache objects are set 'ShowMissingArticle': Called when generating the output for a non-existent page. diff --git a/includes/Linker.php b/includes/Linker.php index 77245486283..b6e6657e34b 100644 --- a/includes/Linker.php +++ b/includes/Linker.php @@ -408,6 +408,11 @@ class Linker { * @return string */ public static function makeSelfLinkObj( $nt, $html = '', $query = '', $trail = '', $prefix = '' ) { + $ret = "{$prefix}{$html}{$trail}"; + if ( !wfRunHooks( 'SelfLinkBegin', array( $nt, &$html, &$trail, &$prefix, &$ret ) ) ) { + return $ret; + } + if ( $html == '' ) { $html = htmlspecialchars( $nt->getPrefixedText() ); }