Révision c8740e19
Ajouté par Assos Assos il y a plus de 9 ans
drupal7/sites/all/modules/menu_attributes/menu_attributes.api.php | ||
---|---|---|
6 | 6 |
*/ |
7 | 7 |
|
8 | 8 |
/** |
9 |
* Alter the list of menu item attributes.
|
|
9 |
* Inform the menu_attributes module about custom attributes.
|
|
10 | 10 |
* |
11 |
* @param $attributes
|
|
11 |
* @return
|
|
12 | 12 |
* An array of attributes to be controlled by Menu Attributes, keyed by |
13 | 13 |
* attribute name. Each attribute record should be an array with the following |
14 | 14 |
* key/value pairs: |
... | ... | |
16 | 16 |
* - description: The attribute description. |
17 | 17 |
* - form: A Form API array. Some default values for this array are provided |
18 | 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. |
|
19 | 22 |
* |
20 | 23 |
* @see menu_attributes_menu_attribute_info() |
21 | 24 |
* @see menu_attributes_get_menu_attribute_info() |
22 | 25 |
*/ |
23 |
function hook_menu_attribute_info(array &$attributes) {
|
|
26 |
function hook_menu_attribute_info() { |
|
24 | 27 |
// Add a Tabindex attribute. |
25 | 28 |
$info['tabindex'] = array( |
26 | 29 |
'label' => t('Tabindex'), |
... | ... | |
29 | 32 |
'#maxlength' => 3, |
30 | 33 |
'#size' => 2, |
31 | 34 |
), |
35 |
'scope' => array(MENU_ATTRIBUTES_LINK), |
|
32 | 36 |
); |
33 | 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) { |
|
34 | 52 |
// Remove the Access Key attribute. |
35 | 53 |
unset($attributes['accesskey']); |
36 | 54 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules