Returns an array containing all links for a menu.
$menu_name: The name of the menu whose links should be returned.
An array of menu links.
function menu_load_links($menu_name) {
$links = db_select('menu_links', 'ml', array(
'fetch' => PDO::FETCH_ASSOC,
))
->fields('ml')
->condition('ml.menu_name', $menu_name)
->orderBy('weight')
->execute()
->fetchAll();
foreach ($links as &$link) {
$link['options'] = unserialize($link['options']);
}
return $links;
}