Follow-up: clean up old Advanced Menu builder and add hook support

Old MainMenuAdvancedBulder doesn't require the personal section
any more as that section is handled by new UserMenu.

Additionally we should add hook support in the new UserMenu so
different extensions can add their own menu entries.

Bug: T214540
Change-Id: Ibbfbee9d13d58c92d90a22d2b6dcf124b1313c23
This commit is contained in:
Piotr Miazga 2019-07-25 12:43:34 +02:00
parent a2521d7d6a
commit e117ee433a
2 changed files with 2 additions and 15 deletions

View File

@ -73,7 +73,6 @@ final class AdvancedBuilder implements IBuilder {
public function getGroups(): array {
return [
BuilderUtil::getDiscoveryTools( $this->definitions ),
$this->getPersonalTools(),
$this->getSiteTools(),
BuilderUtil::getConfigurationTools( $this->definitions, $this->showMobileOptions ),
];
@ -88,20 +87,6 @@ final class AdvancedBuilder implements IBuilder {
return BuilderUtil::getSiteLinks( $this->definitions );
}
/**
* Builds the personal tools menu item group.
* @return Group
* @throws FatalError
* @throws MWException
*/
private function getPersonalTools(): Group {
$group = new Group();
// Allow other extensions to add or override tools
Hooks::run( 'MobileMenu', [ 'personal', &$group ] );
return $group;
}
/**
* Prepares a list of links that have the purpose of discovery in the main navigation menu
* @return Group

View File

@ -19,6 +19,7 @@
*/
namespace MediaWiki\Minerva\Menu\User;
use Hooks;
use IContextSource;
use MediaWiki\Minerva\Menu\Definitions;
use MediaWiki\Minerva\Menu\Entries\ProfileMenuEntry;
@ -95,6 +96,7 @@ final class AdvancedUserMenuBuilder implements IUserMenuBuilder {
} else {
$this->definitions->insertLogOutMenuItem( $group );
}
Hooks::run( 'MobileMenu', [ 'user', &$group ] );
return $group;
}
}