1

I've read the questions already asked but they didn't answer my question. But they were sucessful in confusing me more. There are hooks, render functions of two types, theme functions, pre-processing functions, processing functions. In every question I read over internet the answer is different every time. My head's gonna explode.

Coming to question, I need just the text & href from menu-item or link. I'll handle the rest.

How I want it?

//I need control over the HTML wrapper elements for menu
foreach $menu_items as $menu_item:
    if(has_submenu($menu_item)):
        print "custom html here";
        foreach $menu_item as $sub_menu_item:
            print "custom html here".$sub_menu_item['name'].$sub_menu_item['href']."custome html here";
    endif
    print "custom html here".$menu_item['name'].$menu_item['href']."custome html here";
3
  • No! No! No! enough with marking duplicates. Newbies like me get lost moving from one question to another. The situation changes, question changes & because its asked by someone else, what one knows also changes. Most of the time gets spent on reading others questions only to find out that its not I want or to find its too complicated to understand. Its just too inefficient. I asked a direct question. I need a direct answer please
    – claws
    Commented Feb 25, 2014 at 11:48
  • We can certainly point you to the right functions/disciplines within Drupal, but I just want to make sure you know that we can't write your full code for you. What I mean is that if an answer to a different question provides the theoretical answer to your question, it will be closed as a duplicate - we don't provide one-one support, so if it's a matter of 'that one works but I want it blue', then it's fair game to be closed as a dupe. I'm not saying this is a dupe (though I suspect it is, this has been asked quite a few times if I recall), just don't be shocked if it does get closed as such
    – Clive
    Commented Feb 25, 2014 at 12:07
  • A bit more info from you would actually be useful in working that out - how is this menu being rendered? Through theme_links in a template file or some other method?
    – Clive
    Commented Feb 25, 2014 at 12:11

1 Answer 1

2

Try to use: menu_tree_all_data(). It will get a menu tree of your given menu machine name.

Not the answer you're looking for? Browse other questions tagged or ask your own question.