-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenu_attributes.api.php
56 lines (52 loc) · 1.64 KB
/
menu_attributes.api.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
* @file
* Documentation for Menu Attributes API.
*/
/**
* Inform the menu_attributes module about custom attributes.
*
* @return
* 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 menu_attributes_menu_attribute_info()
* @see menu_attributes_get_menu_attribute_info()
*/
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;
}
/**
* Alter the list of menu item attributes.
*
* @param $attributes
* An array of attributes to be controlled by Menu Attributes, keyed by
* attribute name.
*
* @see hook_menu_attribute_info()
* @see menu_attributes_get_menu_attribute_info()
*/
function hook_menu_attribute_info_alter(array &$attributes) {
// Remove the Access Key attribute.
unset($attributes['accesskey']);
}