From: Daniel Kinzler Date: Wed, 2 Jul 2008 20:02:51 +0000 (+0000) Subject: Add hook to replace logic for generating category links. May be used by CategoryTree... X-Git-Tag: 1.31.0-rc.0~46794 X-Git-Url: http://git.cyclocoop.org/%27%20.%20url_absolue%28%24favicon%29%20.%20?a=commitdiff_plain;h=4ae25d6b4cb020c435beac46e2980c6ace35e02f;p=lhc%2Fweb%2Fwiklou.git Add hook to replace logic for generating category links. May be used by CategoryTree one day. --- diff --git a/docs/hooks.txt b/docs/hooks.txt index 57e6a85e79..8a787c3f33 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -859,6 +859,12 @@ $text: the text that will be displayed, in HTML (string) $out: OutputPage instance (object) $parserOutput: parserOutput instance being added in $out +'OutputPageMakeCategoryLinks': links are about to be generated for the page's categories. + Implementations should return false if they generate the category links, so the default link generation is skipped. +$out: OutputPage instance (object) +$categories: associative array, keys are category names, values are category types ("normal" or "hidden") +$links: array, intended to hold the result. Must be an associative array with category types as keys and arrays of HTML links as values. + 'PageHistoryBeforeList': When a history page list is about to be constructed. $article: the article that the history is loading for diff --git a/includes/OutputPage.php b/includes/OutputPage.php index d6a6877cc9..99c752be27 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -320,11 +320,13 @@ class OutputPage { } # Add the remaining categories to the skin - $sk = $wgUser->getSkin(); - foreach ( $categories as $category => $type ) { - $title = Title::makeTitleSafe( NS_CATEGORY, $category ); - $text = $wgContLang->convertHtml( $title->getText() ); - $this->mCategoryLinks[$type][] = $sk->makeLinkObj( $title, $text ); + if ( wfRunHooks( 'OutputPageMakeCategoryLinks', array( &$this, $categories, &$this->mCategoryLinks ) ) ) { + $sk = $wgUser->getSkin(); + foreach ( $categories as $category => $type ) { + $title = Title::makeTitleSafe( NS_CATEGORY, $category ); + $text = $wgContLang->convertHtml( $title->getText() ); + $this->mCategoryLinks[$type][] = $sk->makeLinkObj( $title, $text ); + } } }