mirror of
https://gerrit.wikimedia.org/r/mediawiki/skins/MinervaNeue
synced 2024-11-12 08:58:25 +00:00
Hygiene: Do not insert Random menu entry if message do not exists
The `randompage-url` message might not be defined, or be set to '-' which means - this text do not exist. Minerva should respect that, instead of showing a link that points nowhere/to a '-' page Bug: T188697 Change-Id: If97d29b0e25f3635e94bf3b80b051355ea49cf7d
This commit is contained in:
parent
d2e723daf9
commit
f190f7492a
|
@ -142,11 +142,13 @@ final class Definitions {
|
|||
* @throws MWException
|
||||
*/
|
||||
public function insertRandomItem( Group $group ) {
|
||||
$page = $this->context->msg( 'randompage-url' )->escaped();
|
||||
// Random link
|
||||
$pageMsg = new Message( 'randompage-url' );
|
||||
if ( !$pageMsg->exists() ) {
|
||||
return;
|
||||
}
|
||||
$group->insert( 'random' )
|
||||
->addComponent( $this->context->msg( 'mobile-frontend-random-button' )->escaped(),
|
||||
Title::newFromText( $page )->getLocalURL() . '#/random',
|
||||
Title::newFromText( $pageMsg->escaped() )->getLocalURL() . '#/random',
|
||||
MinervaUI::iconClass( 'random', 'before' ), [
|
||||
'id' => 'randomButton',
|
||||
'data-event-name' => 'random',
|
||||
|
|
Loading…
Reference in a new issue