You are here

function hook_menu_attribute_info in Menu Attributes 8

Same name and namespace in other branches
  1. 6.2 menu_attributes.api.php \hook_menu_attribute_info()
  2. 6 menu_attributes.api.php \hook_menu_attribute_info()
  3. 7 menu_attributes.api.php \hook_menu_attribute_info()

Inform the menu_attributes module about custom attributes.

Return value

An array of attributes to be controlled by Menu Attributes, keyed by attribute name. Each attribute record should be an array with the following key/value pairs:

  • label: The human-readable name of the attribute.
  • description: The attribute description for the link.
  • item_description: The attribute description for the item.
  • form: A Form API array. Some default values for this array are provided in menu_attributes_get_menu_attribute_info().
  • scope: An array of scope options, MENU_ATTRIBUTES_LINK or MENU_ATTRIBUTES_ITEM or both. If no scope is provided, both will be assumed.

See also

menu_attributes_menu_attribute_info()

menu_attributes_get_menu_attribute_info()

2 functions implement hook_menu_attribute_info()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

menu_attributes_get_menu_attribute_info in ./menu_attributes.module
Fetch an array of menu attributes.
menu_attributes_menu_attribute_info in ./menu_attributes.module
Implements hook_menu_attribute_info().
1 invocation of hook_menu_attribute_info()
menu_attributes_get_menu_attribute_info in ./menu_attributes.module
Fetch an array of menu attributes.

File

./menu_attributes.api.php, line 27
Documentation for Menu Attributes API.

Code

function hook_menu_attribute_info() {

  // Add a Tabindex attribute.
  $info['tabindex'] = [
    'label' => t('Tabindex'),
    'description' => t('Specifies the tab order for the link.'),
    'item_description' => t('Specifies the tab order for the item.'),
    'form' => [
      '#maxlength' => 3,
      '#size' => 2,
    ],
    'scope' => [
      MENU_ATTRIBUTES_LINK,
    ],
  ];
  return $info;
}