You are here

function menu_attributes_get_menu_attribute_info in Menu Attributes 7

Same name and namespace in other branches
  1. 8 menu_attributes.module \menu_attributes_get_menu_attribute_info()
  2. 6.2 menu_attributes.module \menu_attributes_get_menu_attribute_info()
  3. 6 menu_attributes.module \menu_attributes_get_menu_attribute_info()

Fetch an array of menu attributes.

2 calls to menu_attributes_get_menu_attribute_info()
menu_attributes_form_menu_configure_alter in ./menu_attributes.module
Implements hook_form_FORM_ID_alter().
_menu_attributes_form_alter in ./menu_attributes.module
Add the menu attributes to a menu item edit form.

File

./menu_attributes.module, line 113
Alters the menu item form to allow the administrator to specify additional attributes for the menu link

Code

function menu_attributes_get_menu_attribute_info() {
  $attributes = module_invoke_all('menu_attribute_info');

  // Merge in default values.
  foreach ($attributes as $attribute => &$info) {
    $info += array(
      'form' => array(),
      'enabled' => variable_get("menu_attributes_{$attribute}_enable", 1),
      'default' => '',
    );
    $info['form'] += array(
      '#type' => 'textfield',
      '#title' => $info['label'],
      '#description' => isset($info['description']) ? $info['description'] : '',
      '#default_value' => variable_get("menu_attributes_{$attribute}_default", $info['default']),
    );
  }
  drupal_alter('menu_attribute_info', $attributes);
  return $attributes;
}