I'am working with the last git changes of Joomla 4.0. In my component, i create the menu items for frontend part during postflight step when installing a component. The issue is that isn't able to find at this step the component ID.

In the script.php file of the component in the postflight (https://github.com/Kunena/Kunena-Forum/blob/K6.0/src/script.php#L265), i call a method to create the menu items :

$installer = new KunenaModelInstall;

The createMenu() method is located here : https://github.com/Kunena/Kunena-Forum/blob/K6.0/src/libraries/kunena/src/Install/KunenaModelInstall.php#L3022

menu manager of Joomla!

Why the component id isn't set at this step ? If i call the methode createMenu() after that the component is installed i don't encounter this issue

1 Answer 1


The component id may not be available yet; you might be able to retrieve it from the db, I did find my own extension in the extensions table at this step but haven't tried; that seems overkill anyways.

Just add the menu and submenu items in the xml of the component, in the administration section, at the same level as files and folders something like this:

    <menu img="components/com_littlehelper/assets/images/logo16.png">COM_LITTLEHELPER</menu>
        <menu link="option=com_littlehelper&amp;view=trash_n_cache" img="components/com_littlehelper/assets/images/joomla16.png">COM_LITTLEHELPER_TRASH_AND_CACHE</menu>

and so on. You can create menus, submenus, and the translations will be automatically be applied. Joomla takes care of it all, so you can avoid the postflight altogether.

Frontend Menus

If your postflight should create a frontend menu and menuitems, here are just some considerations:

  • ensure you are using the new API for Joomla 3.9 and Joomla 4
  • delete the items you create when uninstalling
  • ensure they are not present already before creating them: ever if you delete on uninstall, this will save you some issues.
  • The menus which i want to create in postflight is for frontend. There is a menutype and some sub-menus which this menutype Jan 5, 2021 at 12:24
  • it's not for backend, it's menus for frontend part of the component Aug 25, 2021 at 15:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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