Jump to content

Manual:Hooks/ArticleAfterFetchContentObject

From mediawiki.org
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.php
Interface: ArticleAfterFetchContentObjectHook.php

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


Details

[edit]
  • $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

[edit]
  • Not called when loading page from cache, use ?action=purge to force page render.
  • Also called when fetching article source for action=edit.