Menuitem form field type

From Joomla! Documentation

Params.menuitem.jpg

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

The first option on the list is always '- Select Item -' (which is a translatable string) and is given the value 0.

The first item on the list will always have the ' - Top' (which is a translatable string) appended to it.

  • type (mandatory) must be menuitem.
  • name (mandatory) is the unique name of the field.
  • label (mandatory) (translatable) is the descriptive title of the field.
  • default (optional) is the default menu item. Note that this is the ItemID number of the menu item.
  • description (optional) (translatable) is text that will be shown as a tooltip when the user moves the mouse over the drop-down box.
  • state (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.

Example XML field definition:

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

NOTE[edit]

The above description is wrong. "state" is not a supported attribute for the menuitem type. Instead, use the attribute "published" with a value of 0 for unpublished items or 1 for published ones. Omit the attribute altogether for both published and unpublished items.

See also[edit]