diff --git a/Manager/ToolManager.php b/Manager/ToolManager.php index c90fcfef6..3a9b3ea15 100644 --- a/Manager/ToolManager.php +++ b/Manager/ToolManager.php @@ -159,7 +159,10 @@ public function addWorkspaceTool( /** * @param \Claroline\CoreBundle\Entity\User $user * - * @return \Claroline\CoreBundle\Entity\Tool\Tool + * @param int $type + * @param array $excludedTools + * + * @return \Claroline\CoreBundle\Entity\Tool\Tool[] */ public function getDisplayedDesktopOrderedTools( User $user, @@ -177,9 +180,9 @@ public function getDisplayedDesktopOrderedTools( } /** - * @param \Claroline\CoreBundle\Entity\User $user + * @param integer $type * - * @return \Claroline\CoreBundle\Entity\Tool\Tool + * @return \Claroline\CoreBundle\Entity\Tool\OrderedTool[] */ public function getOrderedToolsLockedByAdmin($type = 0) { diff --git a/Menu/Builder.php b/Menu/Builder.php index 19a63d17c..1a83e0a60 100644 --- a/Menu/Builder.php +++ b/Menu/Builder.php @@ -23,6 +23,7 @@ public function topBarRightMenu(FactoryInterface $factory, array $options) $hasRoleExtension = $this->container->get('claroline.core_bundle.twig.has_role_extension'); $router = $this->container->get('router'); $dispatcher = $this->container->get('event_dispatcher'); + /** @var \Claroline\CoreBundle\Manager\ToolManager $toolManager */ $toolManager = $this->container->get('claroline.manager.tool_manager'); $menu = $factory->createItem('root') @@ -40,6 +41,12 @@ public function topBarRightMenu(FactoryInterface $factory, array $options) ->setAttribute('role', 'presentation') ->setExtra('icon', 'fa fa-cog'); + //allowing the menu to be extended + $this->container->get('event_dispatcher')->dispatch( + 'claroline_top_bar_right_menu_configure', + new ConfigureMenuEvent($factory, $menu) + ); + $this->addDivider($menu, '1'); $menu->addChild( @@ -69,8 +76,11 @@ public function topBarRightMenu(FactoryInterface $factory, array $options) 1, $excludedTools ); + /** @var \Claroline\CoreBundle\Entity\Tool\Tool[] $tools */ $tools = array_merge($adminTools, $desktopTools); + $countPermanentMenuLinks = $menu->count(); + foreach ($tools as $tool) { $toolName = $tool->getName(); @@ -92,13 +102,11 @@ public function topBarRightMenu(FactoryInterface $factory, array $options) } } - //allowing the menu to be extended - $this->container->get('event_dispatcher')->dispatch( - 'claroline_top_bar_right_menu_configure', - new ConfigureMenuEvent($factory, $menu) - ); + $countAddedToolMenuLinks = $menu->count(); - $this->addDivider($menu, '2'); + if ($countPermanentMenuLinks < $countAddedToolMenuLinks) { + $this->addDivider($menu, '2'); + } //logout if ($hasRoleExtension->isImpersonated()) {