The menuitem form field type provides a drop down grouped list of the available menu items from Joomla site.

Example XML field definition:

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

The menuitem form field type gives the ID of the selected menu item. To get a search engine friendly URL using the ID, use JRoute:

JRoute::_("index.php?Itemid={$id}");

Parameters

Mandatory Parameters

  • type must be menuitem.
  • name is the unique name of the field.
  • label (translatable) is the descriptive title of the field.

Optional Parameters

  • default is the default menu item. This is the ItemID number of the menu item.
  • description (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.
  • published determines whether all menu items are listed or only published menu items. If state is '0' then all menu items are listed. If state is '1' then only published menu items are listed.