Custom Menu Fields
Categories
Component ID
Component name
Component type
Maintenance status
Development status
Component security advisory coverage
Component created
Component changed
Component body
The Custom Menu Fields module allows administrators to add variables to menus and menu items, primarily for purposes of development or theming.
Features
- Add fields to menus and menu fields
- Add the following item types:
- Text Field - Add a subtitle field, a name, or anything else you can think of.
- Text Area - Add a secondary description field, a disclaimer, or whatever.
- Checkbox - Add simple checkboxes, e.g. "Hide this item to anonymous users"
- Menu Reference - Link to other menus from the current entity. Build a hierarchical menu structure comprised of smaller menus (allowing for granular menu access) by creating a "Parent menu" field for menus, or a "Sub-menu" field for menu items, for example.
- Menu Item Reference - Link to a specific menu on the site. This actually creates 2 fields: one for "menu" and one for "menu item". The "menu" field dynamically filters the list of "menu items" so that the user doesn't have to choose from every menu item on the site.
- Taxonomy Term Reference - This was created to facilitate support for Workbench Access, but that functionality was moved to another module, Workbench Visibility (not currently shared - let me know if anyone wants it). I left the functionality to link to a taxonomy term in case it would be useful in other scenarios, e.g. to associate menu items to specific tags, which could be used to build dynamic, customized menus (or whatnot).
- User Role - Allows the user to select from a list of user roles. Note that there is a permission that determines which user roles appear in the list.
- Editing a menu field (not to be confused with administering Custom Menu Fields) can be controlled via permission by checking the "Control the ability to edit this field via a permission"
Installation
Place this folder and all subfolders into your modules directory (e.g.
sites/all/modules/menu_fields)
Enable the Custom Menu Fields module from Drupal's module list (admin/modules in
Drupal 7).
Set the appropriate permissions. Custom Menu Fields creates two base permissions: One for administering Custom Menu Fields, and another for ignoring menu restrictions. The latter is only relevant if you are using Custom Menu Fields in conjunction with Workbench Access.
Additional "edit" permissions will also be created for menu fields that have the "permissioned" box checked.
How to use Menu Fields
Add, modify or remove fields at: admin/structure/menu_fields
Use the following function to retrieve Menu Field data:
menu_fields_get_value($item_id, $mfid)
Returns the value of a given menu (or menu item) field.
$item_id
The menu or menu item ID.
$mfid
Either the name of the field or the ID of the field. Using the ID
yields better performance. The ID is displayed at admin/structure/menu_fields
