see: http://drupal.org/node/160168#comment-311460

recopied here:

submitted by markus-v-drupal on September 26, 2007 - 19:22

Hi.
if you set "source for secondary links = primary links" and activate the "secondary links box" you get an empty box because links from the menu called "secondary-links" are shown.

I changed the following in function menu_block($op, $delta) to get it working:


  else if ($op == 'view') {
    $data['subject'] = check_plain($menus[$delta]);
    if ($delta == 'secondary-links' && variable_get('menu_secondary_links_source', 'secondary-links') == 'primary-links') {
      $tree = menu_tree_page_data('primary-links');
      foreach ($tree as $link_data) {
        if ($link_data['link']['in_active_trail']) {
          $data['content'] = menu_tree_output($link_data['below']);
          break;
        }
      }
    }
    else {
      $data['content'] = menu_tree($delta);
    }
  return $data;
}

hope this is the right place. i'm not sure if it is the right way to do....

So the issue is basically a confusion between the "Secondary links" menu, and the "secondary links" as displayed (for example) at the top of the page below the primary links. I agree this could be confusing, but I don't think the above code is the correct approach.

CommentFileSizeAuthor
#13 menu.module.patch920 bytesJamieR
#9 menu.module.patch852 byteskipkoan

Comments

wwmv’s picture

I'm not sure you understand me correct, so i will try to explain it in in more detail.

First of a you can activate a block for every menu which will display to contens of this menu, right?
The "Secondary links" menu however is special because you can choose the source of the items.

If Primary links is chosen the children of the active primary menu link (if any) will be shown instead of the links in the Secondary links menu.

The problem about all this is the disability of the Menu2Block Code to distinguish the source of the Secondary links menu. This means you get an empty Block if your "Secondary links Source" is "Primary links".

OK, i can see now why you describe this as "confusion between ..." :-/

However i think it is logical to assume that the a "secondary links block" is displaying the secondary links whatever the the source may be. But i also agree that this code is not the correct approach. I will think about it and hopefully get a working .patch file.

pwolanin’s picture

I think the best approach would be to correct the help text- I think the code is correct.

floretan’s picture

So the issue is basically a confusion between the "Secondary links" menu, and the "secondary links" as displayed (for example) at the top of the page below the primary links.

There is indeed a problem with the two different meanings of "secondary links" (and it doesn't seem to be new in drupal 6). I tried to think of a different name that would best describe the second case, but the problem is that if we change that name we will also need to modify the php code to reflect those changes (no functional changes, but renaming variables and functions). If we only change the help text, the only result will be that the developers will be confused instead of the users...

wwmv’s picture

In Drupal links are created from items in the corresponding menu e.g. the "Primary Links" are generated from the items in the "Primary Links" menu. Right?
So are the "Secondary Links". The only difference is that there are two diffrent sources for the items. imho...

So, i propose to make the following changes (on admin/build/menu/settings):
"Source for the secondary links:" -> "Source for the Secondary links menu items:"
"Secondary links" -> "Secondary links menu"
"Primary links" -> "Primary links menu"
and the helptext of course. (there is a typo anyway (choosen)) maybe like
... -> "If 'Primary links menu' is chosen the children of the active Primary links menu item (if any) will be shown instead of the links in the Secondary links menu."

I think this will do it without the need to rename any code, but YOU know the code better than me and I don't want to argue with you about that.

But i still think that from a user point of view secondary links are secondary links whoever the source is and therefore they should always appear in the Secondary links block. I mean this block is useless if 'Primary links menu' is the source ...

Sorry for the trouble and my pore English but I expected a different behaviour from Drupal.

wim leers’s picture

Version: 6.x-dev » 7.x-dev
MestariM’s picture

Version: 7.x-dev » 6.x-dev

Is there any updates on whether this is going to be fixed? It's just illogical, even if it wouldn't be a bug as such, but just a lack of feature.

I can't count on the template hardcoding, since I want to control on which pages the secondary links are to be shown...

doughold’s picture

Yeah, any news on this. I am trying to use the secondary links block to show the second level of the primary links menu...

kipkoan’s picture

StatusFileSize
new852 bytes

I tweaked the above code slightly allowing the primary & secondary links to use menus other than just "primary links". Patch file attached. Tested with Drupal 6.

[edit] -- bug fix in patch: do not try to display secondary menus if there are none -- causes a php warning if you do

Paul Natsuo Kishimoto’s picture

Category: bug » feature
Status: Active » Needs review

Subscribing.

@KipBond: I am marking this "patch (code needs review)" but I can't assign the feature request to you. If you want to update to take it, please do, as it's your patch.

I will try to test and review shortly.

Paul Natsuo Kishimoto’s picture

Title: usability - what should be in the secondary links block? » "Secondary links" block should show children of the active primary menu link to be consistent with admin/build/menu/settings
Paul Natsuo Kishimoto’s picture

KipBond, I can confirm your patch of #9 works, but I don't think it is done according to the patch guidelines: http://drupal.org/patch/create

Can you reroll as it says there?

JamieR’s picture

StatusFileSize
new920 bytes

It's working for me as well. Here is a new patch file against drupal-6.10. Thanks!

doughold’s picture

Awesome, this patch worked great for me on 6.10. Will it be committed to the core so we don't have to re-apply it upon an upgrade?

pwolanin’s picture

Status: Needs review » Needs work

no, I don't think this is the right solution - we have a 1-to-1 relationship of blocks to menus.

doughold’s picture

Status: Needs work » Needs review

Also, is there any way that we can make the title of the block the same as the parent menu item instead of "Secondary links"? I feel like that would make more sense.

pwolanin’s picture

Status: Needs review » Needs work
doughold’s picture

Sorry, didn't mean to change the status...pwolanin, if this is not the right way to do it, what would you recommend doing for a secondary links block that draws it's info from the primary links menu tree?

mattyoung’s picture

.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.