Podręcznik:Stopka
Dodanie linków do stopki
Wersja MediaWiki: | ≥ 1.35 |
In MediaWiki 1.35, links can be added or overridden via the SkinAddFooterLinks hook. (See Manual:Footer/legacy for older installs.) For example, in an extension:
- Internal links
// Add a link to the page "Test Page" with the text "Test", allowing modification by wiki administrators
// test-desc and test-page are i18n messages with the text of the link and the name of the page, respectively
public static function onSkinAddFooterLinks( Skin $skin, string $key, array &$footerlinks ) {
if ( $key === 'places' ) {
$footerlinks['test'] = $skin->footerLink( 'test-desc', 'test-page' );
}
}
The two parameters passed to the skin::footerlink
function should be i18n message keys. This means the eventual value will be taken from the content of the MediaWiki namespace page corresponding to those message keys; in this case the contents of the pages MediaWiki:test-desc and MediaWiki:test-page.
The first parameter should contain the link text, the second the name of the page to link to. See the Class level documentation for more details.
- External links
// Add a link to this page (https://www.mediawiki.org/wiki/?curid=6031)
// test-desc is an i18n message of the text
public static function onSkinAddFooterLinks( Skin $skin, string $key, array &$footerlinks ) {
if ( $key === 'places' ) {
$footerlinks['test'] = Html::element( 'a',
[
'href' => 'https://www.mediawiki.org/wiki/?curid=6031',
'rel' => 'noreferrer noopener' // not required, but recommended for security reasons
],
$skin->msg( 'test-desc' )->text()
}
}
Or if you are a site admin you can do it in LocalSettings.php . See the examples for:
- Internal links
Wersja MediaWiki: | ≥ 1.35 |
$wgHooks['SkinAddFooterLinks'][] = function ( Skin $skin, string $key, array &$footerlinks ) {
if ( $key === 'places' ) {
$footerlinks['test'] = Html::element( 'a', [
'href' => Title::newFromText(
$skin->msg( 'test-page' )->inContentLanguage()->text()
)
], $skin->msg( 'test-desc' ) );
};
};
- External links
// Add a link to this page (https://www.mediawiki.org/wiki/?curid=6031)
// test-desc is an i18n message of the text
$wgHooks['SkinAddFooterLinks'][] = function ( Skin $skin, string $key, array &$footerlinks ) {
if ( $key === 'places' ) {
$footerlinks['test'] = Html::element( 'a',
[
'href' => 'https://www.mediawiki.org/wiki/?curid=6031',
'rel' => 'noreferrer noopener' // not required, but recommended for security reasons
],
$skin->msg( 'test-desc' )->text()
);
};
};
Dostosowywanie wbudowanych wpisów
Możesz też dostosować już wbudowane linki poprzez modyfikację odpowiednich stron lub parametrów:
lastmod
- (ostatnio zmodyfikowano) – edytuj MediaWiki:Lastmodified. Jeżeli $wgMaxCredits jest włączony to zmień MediaWiki:Lastmodifiedatby. Możesz też zmienić MediaWiki:othercontribs pokazujący innych autorów zmian. (6518)
credits
-
- (autorzy) - jeżeli ustawienie $wgMaxCredits nie będzie zerem to wyświetli użytkowników, którzy edytowali stronę
- np. ustaw
$wgMaxCredits = 10;
lub inną liczbę
copyright
- (prawa autorskie) - zmień w MediaWiki:Copyright. Parametr $wgRightsText jest zamieniany na link do strony opisującej szczegóły dotyczących praw autorskich dotyczących twojej wiki. W pliku LocalSettings.php ustawienie $wgRightsText zawiera tytuł linku do tej strony a $wgRightsPage lub $wgRightsUrl tytuł strony na wiki lub zewnętrzny URL.
privacy
- (polityka prywatności) - jest samym linkiem. Zmień MediaWiki:Privacy aby ustawić tytuł linku oraz MediaWiki:Privacypage aby podać tytuł strony, do której ma prowadzić link.
about
- (o stronie) - jest samym linkiem. Zmień MediaWiki:Aboutsite aby ustawić tytuł linku oraz MediaWiki:Aboutpage aby podać tytuł strony, do której ma prowadzić link.
disclaimer
- jest samym linkiem. Zmień MediaWiki:Disclaimers aby ustawić tytuł linku oraz MediaWiki:Disclaimerpage aby podać tytuł strony, do której ma prowadzić link.
tagline
- aktualnie nie jest używane w stopce
Aby usunąć całkowicie link do polityki prywatności, o stronie lub disclaimer zastąp tekst linku kreską ("-
").
Obrazki
- Zobacz $wgFooterIcons .
Tekst i obrazki
As of September 2016, there does not seem to be a standard way to add an entry which consists of text and an image at the same time.