Open main menu

Topic on Extension talk:MobileFrontend

MODIFY THE MAIN MENU

5
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

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.

Reply to "MODIFY THE MAIN MENU"