Extension:BaseHooks

From MediaWiki.org
Jump to navigation Jump to search
MediaWiki extensions manualManual:Extensions
Crystal Clear action run.svg
BaseHooks

Release status:Extension status experimental

DescriptionTemplate:Extension#description add strings or files before end of body tag
Author(s)Template:Extension#username (VictorPortontalk)
Latest versionTemplate:Extension#version 0.1.0-alpha
LicenseTemplate:Extension#license GNU General Public License 2.0 or later
Download
ParametersTemplate:Extension#parameters
$wgBaseHooksAfterBottomScriptsNamespaceStrings, $wgBaseHooksAfterBottomScriptsStrings, $wgBaseHooksAfterBottomScriptsNamespaceFiles, $wgBaseHooksAfterBottomScriptsFiles

unknown

Translate the BaseHooks extension if it is available at translatewiki.net

Check usage and version matrix.

The BaseHooks extension inserts strings or files specified at LocalSettings.php before end of body tag. As new hooks will be added in new MediaWiki versions, this extension may be extended to more "insertion points" (hooks).

Installation[edit]

  • Download and place the file(s) in a directory called BaseHooks in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php:
    wfLoadExtension( 'BaseHooks' );
    
  • YesY Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

To users running MediaWiki 1.24 or earlier:

The instructions above describe the new way of installing this extension using wfLoadExtension() If you need to install this extension on these earlier versions (MediaWiki 1.24 and earlier), instead of wfLoadExtension( 'BaseHooks' );, you need to use:

require_once "$IP/extensions/BaseHooks/BaseHooks.php";

Configuration parameters[edit]

$wgBaseHooksAfterBottomScriptsNamespaceStrings
Hash table with keys being namespace IDs. Every element is an array of strings to be inserted before end of body tag
$wgBaseHooksAfterBottomScriptsStrings
An array of strings to be inserted before end of body tag
$wgBaseHooksAfterBottomScriptsNamespaceFiles
Hash table with keys being namespace IDs. Every element is an array of file names to be inserted before end of body tag
$wgBaseHooksAfterBottomScriptsFiles
An array of file names to be inserted before end of body tag
   require_once "$IP/extensions/BaseHooks/BaseHooks.php";
   $wgBaseHooksAfterBottomScriptsStrings = array("<!-- XYZ test. -->");
   $wgBaseHooksAfterBottomScriptsFiles = array("$IP/extensions/BaseHooks/tests/test.inc");

In the current version strings are always inserted before files, but this may change in the future version of this extension.

You can use $wgBaseHooksAfterBottomScriptsNamespaceStrings and/or $wgBaseHooksAfterBottomScriptsNamespaceFiles to override settings for certain namespaces. For example if you set

   $wgBaseHooksAfterBottomScriptsNamespaceStrings[NS_PROJECT] = array();
   $wgBaseHooksAfterBottomScriptsNamespaceFiles[NS_PROJECT] = array();

then nothing will be added to pages of Project: namespace by this module.

TODO[edit]

Should override also

   $wgHooks['SkinBuildSidebar'][]

Other callbacks?