Manual:Hooks/ArticleAfterFetchContentObject

Category:MediaWiki hooks#ArticleAfterFetchContentObject Category:Hooks added in MediaWiki 1.21.0#ArticleAfterFetchContentObject Category:MediaWiki deprecated or obsolete features#ArticleAfterFetchContentObject Category:Hooks deprecated in MediaWiki 1.32.0#ArticleAfterFetchContentObject
ArticleAfterFetchContentObject
Available from version 1.21.0
After fetching content of an article from the database.
Define function:
public static function onArticleAfterFetchContentObject( &$article, Content &$content = null ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"ArticleAfterFetchContentObject": "MediaWiki\\Extension\\MyExtension\\Hooks::onArticleAfterFetchContentObject"
	}
}
Called from: File(s): page/Article.phpCategory:MediaWiki hooks included in Article.php#ArticleAfterFetchContentObject
Interface: ArticleAfterFetchContentObjectHook.php

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

Details

  • $article: the article (object) being loaded from the database
  • &$content: the content of the article, as a Content object. Null if the user does not have access to the provided content.

Notes

  • Not called when loading page from cache, use ?action=purge to force page render.
  • Also called when fetching article source for action=edit.
Category:Hooks added in MediaWiki 1.21.0 Category:Hooks deprecated in MediaWiki 1.32.0 Category:MediaWiki deprecated or obsolete features Category:MediaWiki hooks Category:MediaWiki hooks included in Article.php