< Manual:Hooks 
 
 
      | SiteNoticeBefore | |
|---|---|
| Available from version 1.7.0 Used to modify the sitenotice before it has been created from $wgSiteNotice. Return false to suppress or modify default site notice. | |
| Define function: | public static function onSiteNoticeBefore( &$siteNotice, $skin ) { ... }
 | 
| Attach hook: | In extension.json: {
	"Hooks": {
		"SiteNoticeBefore": "MyExtensionHooks::onSiteNoticeBefore"
	}
}
 | 
| Called from: | File(s): Skin.php | 
| Interface: | SiteNoticeBeforeHook.php | 
For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:SiteNoticeBefore extensions.
Details
- $siteNotice: Empty string, ignored if the hook returns true.
- $skin: Skin object MW 1.18+
If the function returns false, no attempt will be done to load the sitenotice from interface messages or $wgSiteNotice, and the contents of $siteNotice will be used instead. If the function returns true, there will be no change in behavior of the sitenotice.
Example
If the database is read only ($wgReadOnly) and there's a sitenotice in MediaWiki:Sitenotice you want to override, you can use this hook for that purpose:
$wgHooks['SiteNoticeBefore'][] = function ( &$siteNotice, $skin ) {
	$siteNotice = "There's ongoing maintenance to the site. We'll open editing shortly.";
	return false;
};
See also
    This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.