Jump to content

Extension:SimpleFooterLink

From mediawiki.org
MediaWiki extensions manual
SimpleFooterLink
Release status: beta
Implementation User interface
Description This extension provides a simple way to add any link that system administrators want to footer link area.
Author(s) AnnAngelatalk
Latest version 0.1.1 (2021/03/23)
Compatibility policy For every MediaWiki release that is a Long Term Support release there is a corresponding branch in the extension.
MediaWiki 1.35+
License GNU General Public License 2.0 or later
Download
$wgSimpleFooterLinkArray

The SimpleFooterLink extension provides a simple way to add any link that system administrators want to footer link area.

This extension requires MW 1.35.0 or higher. If you have lower MW version, just simply use legacy way.

Installation

[edit]
  • Download and place the file(s) in a directory called SimpleFooterLink in your extensions/ folder.
  • Add the following code at the bottom of your LocalSettings.php file:
    wfLoadExtension( 'SimpleFooterLink' );
    $wgSimpleFooterLinkArray = [ /* see [[#Configuration parameters]] */ ];
    
  • Yes Done – Navigate to Special:Version on your wiki to verify that the extension is successfully installed.

Usage

[edit]
  1. Add link to a wiki page at footer link area:
    $wgSimpleFooterLinkArray = [
        [
            "name" => "ALink",
            "tag" => "a",
            "attr" => [
                "href" => "Extension:SimpleFooterLink"
            ],
            "innerHTML" => "Extension:SimpleFooterLink",
        ]
    ];
    
    The link Extension:SimpleFooterLink will be added.
  2. You can add extenal link, multiple links, links with blob text, and even not link but <table> (but to be honest table looks ugly in this situation):
    $wgSimpleFooterLinkArray = [
        [
            "name" => "ALink",
            "tag" => "a",
            "attr" => [
                "href" => "https://www.mediawiki.org/wiki/Extension:SimpleFooterLink"
            ],
            "innerHTML" => "Extension:SimpleFooterLink",
        ],
        [
            "name" => "AnotherLink",
            "tag" => "a",
            "attr" => [
                "href" => "https://zh.moegirl.org.cn/",
                "target" => "_blank"
            ],
            "innerHTML" => "<b>MoegirlPedia</b>",
        ],
        [
            "name" => "NotALink",
            "tag" => "table",
            "attr" => [
                "style" => "border-width: 0;",
                "class" => "wikitable"
            ],
            "innerHTML" => "<tr><td>cell</td></tr>",
        ]
    ];
    

Configuration parameters

[edit]
Configuration parameters
Name Value typing
$wgSimpleFooterLinkArray Unnamed array, fulfilled with key-value named array described as right
(Forgive my poor English ...)
name string

Must be identical, or only the very last one keep and other lost.

tag string

HTML element tagname, in lower case, pass to Html::rawElement as first parameter - $element.

attr key-value named array

HTML attributes key-value map, pass to Html::rawElement as second parameter - $attribs, also see Html::expandAttributes for detail.
CAUTION: if tag is "a", attr has key "href", then attr.href will be parsed by Skin::makeInternalOrExternalUrl first.

innerHTML string

HTML string without escaped, pass to Html::rawElement as third parameter - $contents.

TODO

[edit]
  • Add ability to use the MediaWiki message system.