When you create a menu for any view of component, there are many options in the menu you can configure. These values can easily be accessed in Joomla code.

To access current menu parameters,

$app = JFactory::getApplication();
// Get active menu
$active = $app->getMenu()->getActive();
// Get params for active menu
$params = $active->params;
// Access param you want
$yourParameter = $params->get('yourParameter');

The $active is object that contains information about the active or current menu. For example: id, menutype, title, alias, route, link, type, level. You can access these like $active->id or $active->title.

While developing component, you can add this code in the view file - view.html.php, and also access parameters in the layout file. For example,

$active = $app->getMenu()->getActive();
$this->params = $active->params;
$title = $this->params->get('page_title', $active->title);

To define any parameter:

$this->params->def('page_heading', $this->params->get('page_title', $active->title));

Standard Parameters

  • menu-anchor_title
  • menu-anchor_css
  • menu_image
  • menu_image_css
  • menu_text
  • menu_show
  • page_title
  • show_page_heading
  • page_heading
  • pageclass_sfx
  • menu-meta_description
  • menu-meta_keywords
  • robots
  • secure

To access Menu parameters from a known Itemid:

$app = JFactory::getApplication();
// Get Itemid from URL
$input = JFactory::getApplication()->input;
$itemId = $input->get->get('Itemid', '0', 'INT');
// Get menu from Itemid
$menuItem = $app->getMenu()->getItem($itemId);
// Get params for menuItem
$params = $menuItem->params;
// Access param you want
$yourParameter = $params->get('yourParameter');