Jump to content

Topic on Extension talk:MobileFrontend

MODIFY THE MAIN MENU

14
Summary by Jdlrobson

This explains how you can circumvent the lack of main menu customisation in MobileFrontend/Minerva skin.

Jackqbox (talkcontribs)
For anyone interested in an personal change of the menu 
edit includes/skins/SkinMinerva.php
  • find
protected function getDiscoveryTools()
  • find the line
// Nearby link (if supported)
  • add above this line
		$menu->insert( 'Upload' )
			->addComponent(
				$this->msg( 'mobile-frontend-upload-button' )->escaped(),
				SpecialPage::getTitleFor( 'Upload',
					MWNamespace::getCanonicalName( $config->get( 'MFContentNamespace' ) ) )->getLocalUrl() .
						'#/test',
				MobileUI::iconClass( 'mf-upload-invert', 'before' ),
				[
					'id' => 'uploadButton',
					'data-event-name' => 'upload',
				]
			);
			
		$menu->insert( 'ListImages' )
			->addComponent(
				$this->msg( 'mobile-frontend-listimages-button' )->escaped(),
				SpecialPage::getTitleFor( 'ListFiles',
					MWNamespace::getCanonicalName( $config->get( 'MFContentNamespace' ) ) )->getLocalUrl() .
						'#/test',
				MobileUI::iconClass( 'mf-listimages-invert', 'before' ),
				[
					'id' => 'listimagesButton',
					'data-event-name' => 'ListImages',
				]
			);


edit i18n/en.json
  • find the line
"mobile-frontend-random-button": "Random",
  • add below
	
"mobile-frontend-upload-button": "Upload",
		
"mobile-frontend-listimages-button": "List Images",
edit extension.json
  • find the line "mobile.mainMenu.icons": {
  • find section

"images": { "anonymous": "resources/mobile.mainMenu.icons/anonymous.svg",

  • add below this line
				
"upload": "resources/mobile.mainMenu.icons/upload.svg",
"listimages": "resources/mobile.mainMenu.icons/listimages.svg",


allocate the folder resources/mobile.mainMenu.icons
  • add in resources/mobile.mainMenu.icons the required 2 new svg files with the desired icon
  • upload.svg
  • listimages.svg

i have tested this modification at twh4u.ddns.net

Sokote zaman (talkcontribs)

hello

in the Address not found:

For anyone interested in an personal change of the menu edit includes/skins/SkinMinerva.php


please check


i am using mediawiki 1.33

minerva:– (1903d1a)

MobileFrontend: 2.1.0


thanks@Jackqbox

31.168.97.178 (talkcontribs)

w/skins/MinervaNeue/includes/skins

Sokote zaman (talkcontribs)

thanks

Nicolas NALLET (talkcontribs)

Hi, With which versions of MediaWiki and MobileFrontend have you tested ?

Thanks

Jackqbox (talkcontribs)

MediaWiki 1.28.0 PHP 5.5.38 (fpm-fcgi) MariaDB 5.5.51-MariaDB

also in older versions ,but i don't have any reference of them anymore. i am focussing right now on 1.28.x There are more easy and fancy menu changes possible like selectable menu items etc , but until now i don't need them. You can see the concept idea of them in an pubic dutch news side NOS . com

-- press pagina's wijzigen --

Aloist (talkcontribs)

Does this work also on Mediawiki 1.31?

Silkwood (talkcontribs)

With MobileFrontend 2.1.0 and MW 1.32 insert:

$menu->insert( 'Upload' )

                        ->addComponent(

                                $this->msg( 'mobile-frontend-upload-button' )->escaped(),

                                SpecialPage::getTitleFor( 'Upload')->getLocalUrl() .'#/upload',

                                MobileUI::iconClass( 'mf-upload-invert', 'before' ),

                                [

                                        'id' => 'uploadButton',

                                        'data-event-name' => 'upload',

                                ]

                        );     

instead.

58.105.133.37 (talkcontribs)

Hi! Thanks for this guide! Just finding trouble with the last part - When you say 'edit extension.json' where are you finding that file? I look in the MobileFront end extension.json but i cannot file mobile.mainMenu.icons in the code, not the folder in the resources folder

Silkwood (talkcontribs)

MobileFrontend extension has changed since 1.32 and mobile.mainMenu.icons disappeared in 1.33

I don't know how to solve the problem so now I have a functioning Upload link without the upload Icon...

We need some help or wait for MinervaNeue to become indipendent from MobileFrontend.

Ciao.


Bazantik (talkcontribs)

Hi, I don't have the line "protected function getDiscoveryTools()" in my SkinMinerva.php. Is it due to some changes between versions of Minerva Neue? Is there any way how to customize/modify the side menu (main menu) for mobile frontend as is it possible in desktop version of MediaWiki (e.g. add AllPages to main menu)?

Thank you!

Exosvs (talkcontribs)

I have the same issue. That line isnt present in SkinMinerva.php

75.164.85.179 (talkcontribs)

Same issue. Those lines aren't present in the latest version of SkinMinerva.php that I just installed for MediaWiki 1.34.2.

Does anyone have an updated method to add a few extra links to the MobileMenu?

Thanks in advance.

Knomanii (talkcontribs)

As others have mentioned, this tutorial is somewhat outdated (GetDiscoveryTools() is no longer present in MinervaSkin.php).

So I made a simple script in Mobile.js that adds custom Mobile Menu items, with options for a nested dropdown menu as well.

I thought I'd share it in case it helps anyone else: Topic:Vqy1kx6q4e0bzvyb

Reply to "MODIFY THE MAIN MENU"