Random link in main menu can be customised

Allow editors to define a different URL for random
by editing
/wiki/MediaWiki:Randompage-url
e.g. Special:RandomRootpage

Bug: T188697
Change-Id: I72bfbb9b02c99faa0c42c3212939f59b9b87149b
This commit is contained in:
jdlrobson 2019-07-02 13:11:20 -07:00
parent e10f8a8b16
commit 6a8853ad25

View file

@ -139,10 +139,11 @@ final class Definitions {
* @throws MWException
*/
public function insertRandomItem( Group $group ) {
$page = $this->context->msg( 'randompage-url' )->escaped();
// Random link
$group->insert( 'random' )
->addComponent( $this->context->msg( 'mobile-frontend-random-button' )->escaped(),
SpecialPage::getTitleFor( 'Randompage' )->getLocalURL() . '#/random',
Title::newFromText( $page )->getLocalURL() . '#/random',
MinervaUI::iconClass( 'random', 'before' ), [
'id' => 'randomButton',
'data-event-name' => 'random',