2

I have a menu that needs to be 3 levels deep. The last level never shows up. All menu items are set to 'Show as expanded'. But if go look at the html of the li items that make up the menu, I see <li class="collapsed" >menuitemname </li>

This problem occurs in bartik as well as b2nature (the one that the site should go live with)

Keep in mind that I made really really sure that under the menu configuration, I set each and every menu item as 'Show as expanded'.

Update The problem even seems a little tougher than I would think. I made a script that changed all of the class values that said 'collapsed' into 'expanded'. After checking the HTML I can see that the script works, but even with all the classes set to 'expanded' still no level 3 to be seen.

Here's the script for what it's worth

window.onload = function(){

    var mainMenu = document.getElementById('block-menu-block-1');
    var menuItems = mainMenu.getElementsByTagName("li");


    for (var i=0; i < menuItems.length; i++ ){

        var attributes = menuItems[i].getAttribute('class');
        var arrayAttributes = attributes.split(' ');
        for (var j=0; j < arrayAttributes.length; j++ ){

            if (arrayAttributes[j] == 'collapsed'){
                arrayAttributes[j] = 'expanded';
                }
            }

        var newAttributes = arrayAttributes.join(' ');
            menuItems[i].removeAttribute('class');
            menuItems[i].setAttribute('class', newAttributes);
        }
}

Update: I can confirm that this problem must be due to a bug.

I reconstructed the same menu on another site(locally this time). When I would put the block of that menu in any region, the expanded menu items just show up because I checked the 'Show as expanded'-checkbox in the configuration after clicking '+ Add link'. It didn't matter if the expanded menu items had actual nodes as path or as path. All worked just fine. Then I also reconstructed the same menu on my problem-site just starting from scratch but the problem persisted.

Update The 3rd level also isn't there in HTML. I also installed and configured the Menu Blocks module to see if this would be of any help but it isn't.

6

This is "by design" of drupal / the themes.

With the help of a module like Menu Block you can create blocks that have the functionality you are searching for and then place the Blocks where the menu was.

  • Installed Menu Blocks, enabled it, set depth to unlimited. Then under advanced settings I checked 'Expand all children of this tree.' Still, the same problem: Level 2 showing ok because level 1 parents are set to show expanded. Level 3-items not showing, eventhough the level 2 parents are all set to "show as expanded". And yes, I made sure under admin-> blocks the regular menu was replaced by the new menu_block one as under left sidebar it says 'Main menu (expanded levels 1+)'. – Immers Mar 5 '12 at 12:32
  • Menu Block will suit your requirements. Check if you are getting 3rd level in HTML atleast, may be some JS changes is needed to show another level. But I am sure Menu BLock will solve this – GoodSp33d Mar 7 '12 at 12:22
  • I did exactly eveything you mentioned. Thanks for the hint about the HTML, I need to mention that there is no 3rd level in there either. – Immers Mar 7 '12 at 14:39
0

So the reason that the HTML was missing for the 3rd level was because of a language problem. English was set to default and enabled while some menu items where in dutch. That's why the those items didn't show anywhere.

  • Ahh ok i18n. That's always a great source of confusion. :p – s.Daniel Mar 14 '12 at 17:57
  • Yes it almost killed me – Immers Mar 15 '12 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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