You are here

function navbar_menu_navigation_links in Navbar 7

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 navbar_menu_navigation_links()
navbar_get_rendered_subtrees in ./navbar.module
Returns the rendered subtree of each top-level navbar link.
navbar_navbar in ./navbar.navbar.inc
Implements hook_navbar().

File

./navbar.module, line 537
Administration navbar for quick access to top level administration items.

Code

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

    // Configure sub-items.
    if (!empty($item['below'])) {
      navbar_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' => 'navbar-link-' . str_replace(array(
        '/',
        '<',
        '>',
      ), array(
        '-',
        '',
        '',
      ), $item['link']['link_path']),
      'class' => array(
        'navbar-icon',
        'navbar-icon-' . strtolower(str_replace(' ', '-', $item['link']['link_title'])),
      ),
      'title' => check_plain($item['link']['description']),
    );
  }
}