r36944 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r36943‎ | r36944 | r36945 >
Date:20:02, 2 July 2008
Author:daniel
Status:old
Tags:
Comment:
Add hook to replace logic for generating category links. May be used by CategoryTree one day.
Modified paths:
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -859,6 +859,12 @@
860860 $out: OutputPage instance (object)
861861 $parserOutput: parserOutput instance being added in $out
862862
 863+'OutputPageMakeCategoryLinks': links are about to be generated for the page's categories.
 864+ Implementations should return false if they generate the category links, so the default link generation is skipped.
 865+$out: OutputPage instance (object)
 866+$categories: associative array, keys are category names, values are category types ("normal" or "hidden")
 867+$links: array, intended to hold the result. Must be an associative array with category types as keys and arrays of HTML links as values.
 868+
863869 'PageHistoryBeforeList': When a history page list is about to be constructed.
864870 $article: the article that the history is loading for
865871
Index: trunk/phase3/includes/OutputPage.php
@@ -320,11 +320,13 @@
321321 }
322322
323323 # Add the remaining categories to the skin
324 - $sk = $wgUser->getSkin();
325 - foreach ( $categories as $category => $type ) {
326 - $title = Title::makeTitleSafe( NS_CATEGORY, $category );
327 - $text = $wgContLang->convertHtml( $title->getText() );
328 - $this->mCategoryLinks[$type][] = $sk->makeLinkObj( $title, $text );
 324+ if ( wfRunHooks( 'OutputPageMakeCategoryLinks', array( &$this, $categories, &$this->mCategoryLinks ) ) ) {
 325+ $sk = $wgUser->getSkin();
 326+ foreach ( $categories as $category => $type ) {
 327+ $title = Title::makeTitleSafe( NS_CATEGORY, $category );
 328+ $text = $wgContLang->convertHtml( $title->getText() );
 329+ $this->mCategoryLinks[$type][] = $sk->makeLinkObj( $title, $text );
 330+ }
329331 }
330332 }
331333

Status & tagging log