root / drupal7 / sites / all / modules / menu_attributes / menu_attributes.api.php @ 5a4b9049
1 |
<?php
|
---|---|
2 |
|
3 |
/**
|
4 |
* @file
|
5 |
* Documentation for Menu Attributes API.
|
6 |
*/
|
7 |
|
8 |
/**
|
9 |
* Inform the menu_attributes module about custom attributes.
|
10 |
*
|
11 |
* @return
|
12 |
* An array of attributes to be controlled by Menu Attributes, keyed by
|
13 |
* attribute name. Each attribute record should be an array with the following
|
14 |
* key/value pairs:
|
15 |
* - label: The human-readable name of the attribute.
|
16 |
* - description: The attribute description.
|
17 |
* - form: A Form API array. Some default values for this array are provided
|
18 |
* in menu_attributes_get_menu_attribute_info().
|
19 |
* - scope: An array of scope options, MENU_ATTRIBUTES_LINK or
|
20 |
* MENU_ATTRIBUTES_ITEM or both. If no scope is provided, both will
|
21 |
* be assumed.
|
22 |
*
|
23 |
* @see menu_attributes_menu_attribute_info()
|
24 |
* @see menu_attributes_get_menu_attribute_info()
|
25 |
*/
|
26 |
function hook_menu_attribute_info() { |
27 |
// Add a Tabindex attribute.
|
28 |
$info['tabindex'] = array( |
29 |
'label' => t('Tabindex'), |
30 |
'description' => t('Specifies the tab order for the link.'), |
31 |
'form' => array( |
32 |
'#maxlength' => 3, |
33 |
'#size' => 2, |
34 |
), |
35 |
'scope' => array(MENU_ATTRIBUTES_LINK), |
36 |
); |
37 |
|
38 |
return $info; |
39 |
} |
40 |
|
41 |
/**
|
42 |
* Alter the list of menu item attributes.
|
43 |
*
|
44 |
* @param $attributes
|
45 |
* An array of attributes to be controlled by Menu Attributes, keyed by
|
46 |
* attribute name.
|
47 |
*
|
48 |
* @see hook_menu_attribute_info()
|
49 |
* @see menu_attributes_get_menu_attribute_info()
|
50 |
*/
|
51 |
function hook_menu_attribute_info_alter(array &$attributes) { |
52 |
// Remove the Access Key attribute.
|
53 |
unset($attributes['accesskey']); |
54 |
} |