I'm not quite sure why, but I ended up with a custom menu and no primary menu, and many themes seem to function better with a primary menu.

Is there a way to clone my custom menu to create a primary menu?

Thanks.

Comments

malc0mn’s picture

The functionality is indeed not foreseen, but this is a great extra feature!

Summit’s picture

Subscribing, greetings, Martijn

malc0mn’s picture

I'll make some time somewhere next week to lok into this.

malc0mn’s picture

Next week never really happened now did it...

I was just looking into this when I realised that I'm not actually sure what you mean by primary menu?

Are you referring to the primary links menu? If so, then there is nothing special about this menu, except maybe for it's machine readable name which is primary-links (that is without the menu- prefix that is automatically added to all menu's that are not installed by default)...

Whenever you clone a menu using this module, the menu- prefix is automatically added as prescribed by the core:

<?php
  // Add 'menu-' to the menu name to help avoid name-space conflicts.
  $menu['menu_base']['menu_name'] = 'menu-'. $menu['menu_base']['menu_name'];
?>

and the module type of it's items is set to menu and not system:

<?php
  $element['#item']['module'] = 'menu';
?>

So: is it the primary links menu you are talking about? Secondary links is the same case...

jsibley’s picture

Yes, I never created a Primary Links menu and set everything up as a custom menu. This menu has 2 levels.

Many themes in Drupal 6 don't seem to support Suckerfish in custom menus (the dropdown option that has worked best for me so far), so my current setup limits my choices of themes.

I'm not sure if things will be different in Drupal 7, but I've been thinking it's time to recreate my menu as a Primary Links menu, if that is more widely supported. I have about 30 pages now and am not sure of the best approach.

So, is there a way that menu clone might help me?

If not, do you have a suggestion of the best way for me to create a Primary Links menu for my existing pages?

Thanks.

jsibley’s picture

I believe I was able to take care of this.

I used menu_clone to clone the menu I had created. Then, using SQL, I replace the menu name that was created in the menu_links table with "primary-links" in each row. I made sure I didn't already have anything in the primary links menu.

I'm not sure what the behavior should be if there is anything in the primary-links menu (probably warn and do nothing), but it seems like it would be easy to provide an option to clone a menu to primary links if you wanted to.

malc0mn’s picture

Version: 6.x-1.0-beta3 » 6.x-1.0-beta5
Component: Miscellaneous » User interface
Assigned: Unassigned » malc0mn

Wel, the thing is this... There are better ways to make the template use a different menu than the primary-links one, by altering / overriding template.php and setting different variables and what not.

But if you really would like Menu Clone to handle it, I can only see 2 options, of which one is really not recommended:

1. Not recommended at all:
add a checkbox to the clone form, with which the user can choose not to prepend the drupal core standard 'menu-' prefix (which is used to avoid namespace conflicts). (I would not like to implement this one, though it is easier than the next option.)

2. Better option, still to be used with caution:
add a checkbox to the clone form, with which the user can choose to clone a particular menu 'to the primary-links' menu. This would mean that all menu-items that are above the ignore row, will be added to the existing primary-links menu.
If the primary-links menu does for some reason not exist, it could be created.

How about a small vote? :-p