2

I want to create a complex menu system as described in the following image:

enter image description here

It looks complex but logically it is simple.

  1. I want to create a block containing Menu items.
  2. Brief description of image for better understanding: There is a Standard main-menu as with all sites, under that, block is there as scenario-1 and scenario-2, I have just make two copy for better understanding. That block I want to keep in first sidebar. Block has three tier, it is just like M-item(main-menu) -> Its sub-menu items -> Its sub-menu items -> Its sub-menu items (So, it is like Parent -> child -> child -> child)
  3. Logic: Hence, when user clicks M-item-1(parent, from main-menu) -> The block's first tier should show that main-menu item and its sub menu under that. Now suppose user clicks M-item-1-B(tier-1 item) hence in the tier-2 that item should display its sub-menu and M-item-1-B should be as title of tier-2 and same way if from tier-2 if user clicks M-item-1-B-b, its sub-menu should display as in the Tier-3. In short I want to display - 3-tier of menu items in one block only. Hence my purpose is to make the entire block dynamic. By default each tier's first menu item should show its sub-menu (as shown in the Scenario-1)
  4. All the menu items which are active should show themselves highlighted (like what comes with any standard menu, when we click that item gets highlighted).
  5. Path dynamics: Instead of click tier by tier if, I paste the path upto 3rd tier, the block should dynamically detect and show accordingly in the block.
  6. This block or its all three sections are not drop-down type, it is just normal menu block.
  7. The menu items is divided into two column as shown in the image block.

What I tried: I tried to achieve by this using the panels module(mini). I choose layout of 3 column and several row. And add the menu in the as content manually and set the visibility as per the path. But this is not a feasible. As you can see for the second tier I have to make the 6X2 panes and for 3rd tied 6X6X2 panes (2 is for 2 columns). This is not at all feasible. I did not try entirely, but i tried to see it, it is working with panel visibility setting.

1

Part 1 - Rules is definitely your friend!

It seems that you should definitely have a look at how the the Rules Block visibility module can help you in "reducing" the challenge contained in your question here.

Admitted, you'll probably need MORE then just that module (and appropriate custom rules) to make it work, but I would definitely recommend this module as part of the solution you're looking for.

Even though your question does say so (yet), I imagine the various scenarios / menu items each also correspond to some combination of paths (URLs). With that, and by using the Rules event "Drupal is initializing", you should even get closer to what you're looking for.

And to avoid you'd get too many (separated) custom rules to make it all work, I'd also try to keep your number of custom rules to a minimum, by also adding the Conditional Rules module to this mix.

Part 2 - BEAN might help too!

Because you have quite some blocks-related requirements, I'd definitely also have a look at the Bean module, to check if it can help also to answer this question. Here is a quote about its project page:

Think of a Bean as a method to provide new types (compared to node this would be a content type) which then provides an add content interface to create as many blocks as you require (see screenshot below). The bean content can then be placed around the site just like any other block.

The video tutorial Drupal Bean module tutorial - using Bean Admin UI provides a great introduction to really understand the power of this module, and the kind of things you can do with it (by only using site building techniques, no custom coding involved). It also shows how the Bean module transforms Drupal blocks into fieldable entities.

So by adding appropriate fields to your blocks, you may be able to reduce the number of blocks you'd actually need. E.g: maybe your Scenario 1 could be implemented with just a single block.

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.