9

By default the custom component can be seen under 'Extensions' menu at admin side. But how can I create my own menu at the top near to 'Extensions' menu like 'My Component' and show sub menu links under that?

  • Are you talking about the same thing Community Builder do? If so, I was initially going to recommend looking through their code, but having looked at it myself I think differently :/ – Lodder Apr 14 '15 at 17:32
  • @Lodder yes, you are correct. I am expecting a similar module. I refer the CB module and I see they have lots of code to achieve it. I thought there could be a simpler way to do and that's the reason of this question. – Malaiselvan Apr 15 '15 at 21:28
6

We can develop an admin side component with the below code snippet.

mod_custommenu.php

$input   = JFactory::getApplication()->input;
$menu    = new JAdminCSSMenu;
$enabled = $input->getBool('hidemainmenu') ? false : true;

// Render the module layout
require JModuleHelper::getLayoutPath('mod_custommenu', $params->get('layout', 'default'));

The above code creates a menu object and load the default.php

default.php

$document = JFactory::getDocument();
$direction = $document->direction == 'rtl' ? 'pull-right' : '';
require JModuleHelper::getLayoutPath('mod_custommenu', $enabled ? 'default_enabled' : 'default_disabled');
$menu->renderMenu('menu', $enabled ? 'nav ' . $direction : 'nav disabled ' . $direction);

The above code will determine how the menu to be displayed. Either enabled or disabled.

default_disabled.php

$menu->addChild(new JMenuNode(JText::_('Menu'), null, 'disabled'));

The above code is just to display the greyed menu in case of disabled.

default_enabled.php

$menu->addChild(new JMenuNode(JText::_('Menu'), '#'), true);
$menu->addChild(new JMenuNode(JText::_('Menu1'), '', 'class:menu1'), 1);
  $menu->addChild(new JMenuNode(JText::_('Menu2'), '#', 'class:menu2'));
  $menu->getParent();
$menu->getParent();

The above code will add the menu and menu items.

  • Very complete and well explained, works great, thank you! – jackJoe Jun 24 '16 at 15:25
4

You will need to override the admin template to do this.

There is a pretty detailed article here that describes how to do this. It was written for Joomla 2.5 but should also work for Joomla 3.0

http://magazine.joomla.org/issues/item/721-Customizing-the-Admin-Menu

  • I'm pretty sure there must be an other way: Virtuemart 3 appears in the top menu after install. – Khaarkh Apr 15 '15 at 7:08
  • They can do that by simply adding a template override during installation – Søren Beck Jensen Apr 16 '15 at 8:31
-1

I was doing it myself but now I use https://extensions.joomla.org/extension/admin-menu-manager

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.