When using current level as the top level, please add an option to hide siblings of the current level.
Given a tree:

Item 1
  Item 1.1
    Item 1.1.1
    Item 1.1.2
  Item 1.2

When viewing contents of 1.1, the Item 1.2 should be hidden using that option.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

adamdicarlo’s picture

Status: Active » Closed (duplicate)
Rob230’s picture

It's not a duplicate of that. Hiding the siblings is different to hiding the children of siblings.

For example, I need to be have a menu tree like this:

Item 1
  Item 1.1
  Item 1.2
Item 2
  Item 2.1
  Item 2.2
Item 3
  Item 3.1

Hiding the children of siblings would result in this:

Item 1
Item 2
  Item 2.1
  Item 2.2
Item 3

Hiding the siblings would result in this:

Item 2
  Item 2.1
  Item 2.2

I can't see any option to achieve this. If you want your menu to show Item 2, it will also show siblings of Item 2 (Item 1 and Item 3). If you start your menu from Item 2, it will only show children of Item 2, and not Item 2 itself.

The closest you can get is to show the title and make it a link, then use CSS to make it look like a menu item and to alter the other menu items to look like they are children of the title.

rikki_iki’s picture

Issue summary: View changes
Status: Closed (duplicate) » Needs review
FileSize
4.67 KB

The attached patch will give you an option to hide the siblings of all menu items in the active trail.
Example, if the active item is 1.1.2, the menu will show:

Item 1
  Item 1.1
    Item 1.1.2
      Item 1.1.2.1
      Item 1.1.2.2

Where Item 1.1.1, Item 1.2 and Item 2 exist but are not rendered .

rikki_iki’s picture

FileSize
5.24 KB

#3 had a line missing sorry, this one works better.

rikki_iki’s picture

FileSize
5.74 KB

The last patch still wasn't working properly. The attached is better.

timdavison’s picture

I had trouble applying the patch, I got the following error: patch: **** malformed patch at line 98: + if ($config['hide_siblings']) {
However I applied the patch manually and it worked fine for me.

saitanay’s picture

Looks like this module has changed a lot since the earlier patch was created. Hence the patch would no more apply.

Recreated the patch based on the latest module. The functionality from the attached patch works as expected.

Every block now comes with a "Hide Siblings" option and when selected the siblings are hidden.

rv0’s picture

Status: Needs review » Needs work

Patch works fine, could use some work though:

- whitespace issues:
hide_siblings-1390526-7.patch:53: trailing whitespace.
hide_siblings-1390526-7.patch:67: trailing whitespace.
hide_siblings-1390526-7.patch:91: trailing whitespace.
warning: 3 lines add whitespace errors.

- code style:
looking at the patch, the code of the last code block in submit function could use some re-alignment.

- user interface:
the siblings option appears in "basic options", should be only shown in "advanced options"

saitanay’s picture

FileSize
9.08 KB

Cleaner one.

Changes:
Whitespace issues, Moved the config to Advanced Section from Basic.

rv0’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 9: hide_siblings-1390526-9.patch, failed testing.

codevoice’s picture

Confirming that patch in #7 works as expected, thanks!

focal55’s picture

I love what was done in this patch. I have the need to control the depth at which the sibling are allowed to show. I will supply a patch shortly.

focal55’s picture

Patch to add an additional field to set a depth at which to stop hiding siblings.

focal55’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

heshanlk’s picture

Status: Needs work » Needs review
FileSize
5.56 KB

Status: Needs review » Needs work

The last submitted patch, 19: hide_siblings-1390526-19.diff, failed testing. View results

heshanlk’s picture

Status: Needs work » Needs review
FileSize
5.16 KB