Merge "Add SelfLinkBeginHook"

This commit is contained in:
jenkins-bot 2014-05-28 22:07:37 +00:00 committed by Gerrit Code Review
commit 27f8aa732e
2 changed files with 13 additions and 0 deletions

View 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.

View 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() );
}