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:
parent
a2521d7d6a
commit
e117ee433a
|
@ -73,7 +73,6 @@ final class AdvancedBuilder implements IBuilder {
|
||||||
public function getGroups(): array {
|
public function getGroups(): array {
|
||||||
return [
|
return [
|
||||||
BuilderUtil::getDiscoveryTools( $this->definitions ),
|
BuilderUtil::getDiscoveryTools( $this->definitions ),
|
||||||
$this->getPersonalTools(),
|
|
||||||
$this->getSiteTools(),
|
$this->getSiteTools(),
|
||||||
BuilderUtil::getConfigurationTools( $this->definitions, $this->showMobileOptions ),
|
BuilderUtil::getConfigurationTools( $this->definitions, $this->showMobileOptions ),
|
||||||
];
|
];
|
||||||
|
@ -88,20 +87,6 @@ final class AdvancedBuilder implements IBuilder {
|
||||||
return BuilderUtil::getSiteLinks( $this->definitions );
|
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
|
* Prepares a list of links that have the purpose of discovery in the main navigation menu
|
||||||
* @return Group
|
* @return Group
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
*/
|
*/
|
||||||
namespace MediaWiki\Minerva\Menu\User;
|
namespace MediaWiki\Minerva\Menu\User;
|
||||||
|
|
||||||
|
use Hooks;
|
||||||
use IContextSource;
|
use IContextSource;
|
||||||
use MediaWiki\Minerva\Menu\Definitions;
|
use MediaWiki\Minerva\Menu\Definitions;
|
||||||
use MediaWiki\Minerva\Menu\Entries\ProfileMenuEntry;
|
use MediaWiki\Minerva\Menu\Entries\ProfileMenuEntry;
|
||||||
|
@ -95,6 +96,7 @@ final class AdvancedUserMenuBuilder implements IUserMenuBuilder {
|
||||||
} else {
|
} else {
|
||||||
$this->definitions->insertLogOutMenuItem( $group );
|
$this->definitions->insertLogOutMenuItem( $group );
|
||||||
}
|
}
|
||||||
|
Hooks::run( 'MobileMenu', [ 'user', &$group ] );
|
||||||
return $group;
|
return $group;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue