1.12.x admin_bar.api.php hook_admin_bar_map()
1.10.x admin_bar.api.php hook_admin_bar_map()
1.11.x admin_bar.api.php hook_admin_bar_map()
1.7.x admin_bar.api.php hook_admin_bar_map()

Provide expansion arguments for dynamic menu items.

The map items must be keyed by the dynamic path to expand, i.e. a menu path containing one or more '%' placeholders. Each map item may have the following properties:

  • parent: The parent menu path to link the expanded items to.
  • arguments: An array of argument sets that will be used in the expansion. Each set consists of an array of one or more placeholders, which again is an array of possible expansion values. Upon expansion, each argument is combined with every other argument from the set (technically, the cartesian product of all arguments). The expansion values may be empty; that is, you do not need to insert logic to skip map items for which no values exist, since Administration bar will take care of that.

See also

admin_bar.map.inc

File

modules/admin_bar/admin_bar.api.php, line 24
API documentation for Administration bar.

Code

function hook_admin_bar_map() {
  // Expand content types below Structure > Content types.
  // The key denotes the dynamic path to expand to multiple menu items.
  $map['admin/structure/types/manage/%node_type'] = array(
    // Link generated items directly to the "Content types" item.
    'parent' => 'admin/structure/types',
    // Create expansion arguments for the '%node_type' placeholder.
    'arguments' => array(
      array(
        '%node_type' => array_keys(node_type_get_types()),
      ),
    ),
  );
  return $map;
}