Jdlrobson has uploaded a new change for review. https://gerrit.wikimedia.org/r/260949
Change subject: Restore the collections link to the mobile personal menu ...................................................................... Restore the collections link to the mobile personal menu Make use of the new improved MobileFrontend hook Depends-On: I3c6cd2ece73fd0247a13493613b40d94f870a7c1 Change-Id: Ia06ff89f4d918f92a766e2ecea97287d97ec4998 --- M extension.json M includes/Gather.hooks.php 2 files changed, 16 insertions(+), 19 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Gather refs/changes/49/260949/1 diff --git a/extension.json b/extension.json index cdff3a4..a8bd237 100644 --- a/extension.json +++ b/extension.json @@ -674,8 +674,8 @@ "EchoGetDefaultNotifiedUsers": [ "Gather\\Hooks::onEchoGetDefaultNotifiedUsers" ], - "MobilePersonalTools": [ - "Gather\\Hooks::onMobilePersonalTools" + "MobileMenu": [ + "Gather\\Hooks::onMobileMenu" ], "UnitTestsList": [ "Gather\\Hooks::onUnitTestsList" diff --git a/includes/Gather.hooks.php b/includes/Gather.hooks.php index f37cf9d..deb2ea8 100644 --- a/includes/Gather.hooks.php +++ b/includes/Gather.hooks.php @@ -235,24 +235,21 @@ /** * Add collections link in personal tools menu - * @param array &$items Items array to be added to menu + * @param string $name of menu + * @param array &$menu that can be altered */ - public static function onMobilePersonalTools( &$items ) { - // Get an array with just watchlist in it. - $itemArray = array_slice( $items, 0, 1 ); - // add collections after it. - $itemArray[] = array( - 'name' => 'collections', - 'components' => array( - 'text' => wfMessage( 'gather-lists-title' )->escaped(), - 'href' => SpecialPage::getTitleFor( 'Gather' )->getLocalURL(), - 'class' => CSS::iconClass( 'collections-icon', 'before', 'collection-menu-item hidden' ), - 'data-event-name' => 'collections', - ) - ); - // combine it with the rest of the array - $items = array_merge( $itemArray, - array_slice( $items, 1, count( $items ) - 1 ) ); + public static function onMobileMenu( $name, &$menu ) { + if ( $name === 'personal' ) { + $item = $menu->insertAfter( 'watchlist', 'collections', false ); + // Get an array with just watchlist in it. + $item->addComponent( wfMessage( 'gather-lists-title' )->escaped(), + SpecialPage::getTitleFor( 'Gather' )->getLocalURL(), + CSS::iconClass( 'collections-icon', 'before', 'collection-menu-item hidden' ), + array( + 'data-event-name' => 'collections', + ) + ); + } return true; } -- To view, visit https://gerrit.wikimedia.org/r/260949 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia06ff89f4d918f92a766e2ecea97287d97ec4998 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Gather Gerrit-Branch: dev Gerrit-Owner: Jdlrobson <jrob...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits