Merge "Add SelfLinkBeginHook"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Wed, 28 May 2014 22:07:37 +0000 (22:07 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 28 May 2014 22:07:37 +0000 (22:07 +0000)
docs/hooks.txt
includes/Linker.php

index 0b072f2..e91f437 100644 (file)
@@ -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.
index 7724548..b6e6657 100644 (file)
@@ -408,6 +408,11 @@ class Linker {
         * @return string
         */
        public static function makeSelfLinkObj( $nt, $html = '', $query = '', $trail = '', $prefix = '' ) {
+               $ret = "<strong class=\"selflink\">{$prefix}{$html}</strong>{$trail}";
+               if ( !wfRunHooks( 'SelfLinkBegin', array( $nt, &$html, &$trail, &$prefix, &$ret ) ) ) {
+                       return $ret;
+               }
+
                if ( $html == '' ) {
                        $html = htmlspecialchars( $nt->getPrefixedText() );
                }