Skip to main content
Version: 5.3 (Upcoming)

Menuitem Form Field

The menuitem form field type provides a drop down list of the available menus from your Joomla! site. If the field has a saved value this is selected when the page is first loaded. If not, the default value (if any) is selected.

  • type (mandatory) must be menuitem.
  • name (mandatory) is the unique name of the field.
  • label (mandatory) (translatable) is the field html label.
  • description (optional) (translatable) is the field description.
  • default (optional) is the default menu item. Note that this is the ItemID number of the menu item.
  • published (optional) determines whether all menu items are listed or only published menu items. If state is '0' then all menu items will be listed. If state is '1' then only published menu items will be listed. You also can use comma separated values like '1,2'.
  • menu_type (optional) filters by the menutype value in database table #__menu or rather the value of form field Menu Type in edit form of a menu.
  • client_id (optional) filters by the client_id value in database table #__menu. '0' for site menu items. '1' for administrator menu items. The default value is '0'.
  • language (optional) filters by the language value in database table #__menu (language tags). You can also use comma separated values like 'en-GB,de-DE'.

Implemented by: libraries/src/Form/MenuitemField.php

Example XML parameter definition

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

To add additional rows with translatable strings (such as "Select" or "Default") add an option to the XML. For example:

<option	value="">JDEFAULT</option>

See also