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.
An array of links as defined above.
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'])),
),
);
}
}