Projet

Général

Profil

Paste
Télécharger (1,66 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / menu_attributes / menu_attributes.api.php @ 2e0f6994

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 for the link.
17
 *   - item_description: The attribute description for the item.
18
 *   - form: A Form API array. Some default values for this array are provided
19
 *     in menu_attributes_get_menu_attribute_info().
20
 *   - scope: An array of scope options, MENU_ATTRIBUTES_LINK or
21
 *     MENU_ATTRIBUTES_ITEM or both. If no scope is provided, both will
22
 *     be assumed.
23
 *
24
 * @see menu_attributes_menu_attribute_info()
25
 * @see menu_attributes_get_menu_attribute_info()
26
 */
27
function hook_menu_attribute_info() {
28
  // Add a Tabindex attribute.
29
  $info['tabindex'] = array(
30
    'label' => t('Tabindex'),
31
    'description' => t('Specifies the tab order for the link.'),
32
    'item_description' => t('Specifies the tab order for the item.'),
33
    'form' => array(
34
      '#maxlength' => 3,
35
      '#size' => 2,
36
    ),
37
    'scope' => array(MENU_ATTRIBUTES_LINK),
38
  );
39

    
40
  return $info;
41
}
42

    
43
/**
44
 * Alter the list of menu item attributes.
45
 *
46
 * @param $attributes
47
 *   An array of attributes to be controlled by Menu Attributes, keyed by
48
 *   attribute name.
49
 *
50
 * @see hook_menu_attribute_info()
51
 * @see menu_attributes_get_menu_attribute_info()
52
 */
53
function hook_menu_attribute_info_alter(array &$attributes) {
54
  // Remove the Access Key attribute.
55
  unset($attributes['accesskey']);
56
}