Projet

Général

Profil

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

root / drupal7 / sites / all / modules / menu_attributes / menu_attributes.api.php @ 13755f8d

1 85ad3d82 Assos Assos
<?php
2
3
/**
4
 * @file
5
 * Documentation for Menu Attributes API.
6
 */
7
8
/**
9 c8740e19 Assos Assos
 * Inform the menu_attributes module about custom attributes.
10 85ad3d82 Assos Assos
 *
11 c8740e19 Assos Assos
 * @return
12 85ad3d82 Assos Assos
 *   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 c8740e19 Assos Assos
 *   - 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 85ad3d82 Assos Assos
 *
23
 * @see menu_attributes_menu_attribute_info()
24
 * @see menu_attributes_get_menu_attribute_info()
25
 */
26 c8740e19 Assos Assos
function hook_menu_attribute_info() {
27 85ad3d82 Assos Assos
  // 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 c8740e19 Assos Assos
    'scope' => array(MENU_ATTRIBUTES_LINK),
36 85ad3d82 Assos Assos
  );
37
38 c8740e19 Assos Assos
  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 85ad3d82 Assos Assos
  // Remove the Access Key attribute.
53
  unset($attributes['accesskey']);
54
}