Manual:Hooks/CategoryPageView

From MediaWiki.org
Jump to: navigation, search
CategoryPageView
Available from version 1.4.3
Called before viewing a categorypage in CategoryPage::view

*Define function:
function fnMyHook( &$categoryArticle ) { ... }

*Attach hook:
$wgHooks['CategoryPageView'][] = 'MyExtensionHooks::someExample';
Called from: CategoryPage.php

*For more information about attaching hooks, see Manual:Hooks.
*For examples of extensions using this hook, see Category:CategoryPageView extensions.


[edit] Details

  • $categoryArticle: CategoryPage instance (CategoryPage is a subclass of Article)

If this method returns false, then the default behavior of CategoryPage::view will be skipped.

[edit] Notes

  • If there is a diff and $diffOnly is set, then the diff would be displayed and this hook won't be reached.
  • This hook is never accessed when previewing a page. The category listing is generated via EditPage::showPreview() instead of CategoryPage:view().
  • An alternative way to modify the appearance of a category page is to use the ArticleFromTitle hook, and create a new Article object using a custom class derived from CategoryPage. This method allows the category page to be customized in both preview and standard view mode. See the CategoryTree extension for an example.
Personal tools
Namespaces
Variants
Actions
Site
Support
Download
Development
Communication
Print/export
Toolbox