function toolbar_menu_navigation_links

Generates an array of links from a menu tree array.

Based on menu_navigation_links(). Adds path based IDs and icon placeholders to the links.

Return value

An array of links as defined above.

2 calls to toolbar_menu_navigation_links()
toolbar_get_rendered_subtrees in drupal/core/modules/toolbar/toolbar.module
Returns the rendered subtree of each top-level toolbar link.
toolbar_toolbar in drupal/core/modules/toolbar/toolbar.module
Implements hook_toolbar().

File

drupal/core/modules/toolbar/toolbar.module, line 504
Administration toolbar for quick access to top level administration items.

Code

function toolbar_menu_navigation_links(&$tree) {
  foreach ($tree as $key => $item) {

    // Configure sub-items.
    if (!empty($item['below'])) {
      toolbar_menu_navigation_links($tree[$key]['below']);
    }

    // Make sure we have a path specific ID in place, so we can attach icons
    // and behaviors to the items.
    $tree[$key]['link']['localized_options']['attributes'] = array(
      'id' => 'toolbar-link-' . str_replace(array(
        '/',
        '<',
        '>',
      ), array(
        '-',
        '',
        '',
      ), $item['link']['link_path']),
      'class' => array(
        'icon',
        'icon-' . strtolower(str_replace(' ', '-', $item['link']['link_title'])),
      ),
    );
  }
}