I have the following XML in my module params:

<field name="menulink" type="menuitem" default="45" label="Select a menu item to show" description="Select a menu item" />

If I echo


Then it shows the ID of the menu in the frontend, how can I get the menu name too?

1 Answer 1


You can use the following:

$menu = Joomla\CMS\Factory::getApplication()->getMenu();
$menuItem = $menu->getItem($menulink);

echo $menuItem->title;

If you var_dump($menuItem);, it will show you which properties are available for said menu item.

  • Perfect! Thank you Jul 20, 2021 at 14:25

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.