MediaWiki extensions manual
Release status: stable
Implementation User interface
Description Easily add or remove buttons to the WikiEditor
Author(s) Martin Schwindl, Martin Keyler
Maintainer(s) Sophivorus
Latest version 3.2 (2019-07-10)
MediaWiki 1.21+
PHP 5.3+
License GNU General Public License 2.0 or later
  • $wgMSWE_remove
  • $wgMSWE_add
Quarterly downloads 7 (Ranked 152nd)
Translate the MsWikiEditor extension if it is available at translatewiki.net

The MsWikiEditor extension allows you to easily add or remove buttons from the WikiEditor from your LocalSettings.php

Installation edit

  • Download and move the extracted MsWikiEditor folder to your extensions/ directory.
    Developers and code contributors should install the extension from Git instead, using:cd extensions/
    git clone https://gerrit.wikimedia.org/r/mediawiki/extensions/MsWikiEditor
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'MsWikiEditor' );
  •   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( 'MsWikiEditor' );, you need to use:

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

Usage edit

To add a button, add its definition to the $wgMSWE_add array in your LocalSettings.php, using the following format:

$wgMSWE_add['button-key'] = [ 'Name of the button', 'Default content', 'Left wrapper', 'Right wrapper', 'URL or path to the image', 'toolbar-section', 'section-group' ];

If the toolbar section and section group are not specified, the button will be added to the "insert" group of the "main" section. Here are a few working examples:

$wgMSWE_add['date'] = [ 'Current date', date( 'Y-m-d' ), '', '', 'extensions/MsWikiEditor/images/date.png' ];
$wgMSWE_add['gallery'] = [ 'Gallery', '<gallery>\\n', 'File:Example1.jpg|Caption1\\nFile:Example2.png|Caption2\\n', '</gallery>', 'extensions/MsWikiEditor/images/gallery.png' ];
$wgMSWE_add['strike'] = [ 'Strike', '<strike>', 'Text', '</strike>', 'extensions/MsWikiEditor/images/strike.png' ];
$wgMSWE_add['email'] = [ 'Email', '[mailto:', 'address@domain.com', ']', 'extensions/MsWikiEditor/images/email.png' ];
$wgMSWE_add['mslink'] = [ 'MsLink', '{{#l:', 'Filename.ext', '}}', 'extensions/MsWikiEditor/images/link.png' ];
$wgMSWE_add['template'] = [ 'Your template', '{{Your template|', 'Parameters', '}}', 'extensions/MsWikiEditor/images/template.png' ];
$wgMSWE_add['signature'] = [ 'Signature', '--~~~~', '', '', 'extensions/MsWikiEditor/images/signature.png' ];
$wgMSWE_add['attention'] = [ 'Attention', '{{Attention|', 'Text', '}}', 'extensions/MsWikiEditor/images/attention.png' ];

To remove a button, just include its key (the 'rel' attribute) in the $wgMSWE_remove array. For example:

$wgMSWE_remove = [ 'advanced', 'characters', 'help', 'file', 'reference', 'ilink', 'xlink' ];

By default, both arrays are empty.

See also edit