In 6.x, we now have this lovely "Menu settings" thing right at the top of the form so that you can add your "About" link _right there_ as you create your "About" us page. Awesome!

But, the menu's Parent item defaults to "<Navigation>", that awful, ugly, mess of a menu with a mish-mash of every last module's left-over crap. That's not nice! Let's default it to "<Primary Links>" instead, which the admin has a lot more control over, and in 99.9% of the cases, is probably where they want to put that page anyway.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

patchnewbie’s picture

Assigned: Unassigned » patchnewbie

This would be a good patch for someone new to Drupal.

RobLoach’s picture

Is webchick's secret identity "patchnewbie"?!

webchick’s picture

Haha, yeah. It's my way of "tagging" issues for new people. :P

Jody Lynn’s picture

Status: Active » Needs review
FileSize
1.08 KB

I removed variable_get('menu_default_node_menu', 'navigation') because the variable is set in system.install system_update_6021() where I'd be afraid to change it.

webernet’s picture

I'm tempted to 'won't fix' this since it's configurable at /admin/build/menu/settings

Jody Lynn’s picture

That's true, but maybe it should be set to 'primary links' by default as that configuration?

webchick’s picture

Status: Needs review » Needs work

@webernet: Yes, of course it is. But that value should default to Primary links, not Navigation. It's just one other stupid step that 99% of people need to do to setup their Drupal site. If someone really wants to dump _more_ links into Navigation, they can go there and switch it. :)

@Lynn: Thanks for this patch!! A couple of comments:

1. This is pretty close, but not quite what we're after. This code:

variable_get('menu_default_node_menu', 'navigation');

...means, "Go and find a variable called 'menu_default_node_menu', which is set from a settings page (in this case, admin/build/menu/settings). If you find it, go get that value. If not, default it to 'navigation'."

So rather than do this, which would hard-code $menu_name to _always_ be 'primary-links':

        $menu_name = 'primary-links';

Let's try something like this instead, so that it defaults to the proper menu, but is still configurable from the settings page:

        $menu_name = variable_get('menu_default_node_menu', 'primary-links');

You'll want to search for other places where that menu_default_node_menu is and change them accordingly, too.

2. When you create patches, you should do it from the "root" of your Drupal installation (the same directory that has index.php, INSTALL.txt, etc. in it). This just makes it a little easier for people to try it out.

Hope that helps!

Jody Lynn’s picture

Status: Needs work » Needs review
FileSize
1.97 KB

Ok - I am making the patches with Textmate, so I'm trying to get the hang of making the right the modifications to them to make them right. I think I have this one now from root right, but now I had to patch two files so I just pasted the two patches together (is there more to it?)

webchick’s picture

Status: Needs review » Needs work

I get this trying to apply the patch:

Macintosh-4:head webchick$ patch -p0 < menu-default.patch 
patching file modules/menu/menu.module
patching file modules/menu/menu.admin.inc
patch unexpectedly ends in middle of line
Hunk #1 FAILED at 604.
1 out of 1 hunk FAILED -- saving rejects to file modules/menu/menu.admin.inc.rej

Not quite... two problems....

First is the hunk FAILED stuff. This means that it couldn't find the line it's supposed to change anymore. What happened was someone fixed an indenting problem there in another patch which affected the same line you're trying to change, so it couldn't find the right line anymore.

When you get this, it means that the version of Drupal you're trying to patch is not quite up to date. The best thing to do is to check out Drupal from CVS and do your patching from there. Check out http://drupal.org/node/320 for more info.

If that's not an option, the latest copy of the 6.x dev tarball usually works as well.

The second problem is the "patch unexpectedly ends in middle of line." This is caused by the blank line in between:

       '#title' => t('Parent item'),

and:

Index: menu.admin.inc

Unfortunately, I don't have TextMate, so I'm not sure why on earth it's generating patches like that. I sense that you had to generate one patch per file and then manually piece them together. That's too bad if it doesn't have an option to roll one patch for the entire thing, because that sounds very inconvenient. :(

How I would do this from the command prompt is:

cd ~/Sites/head # the root of my local installation of the latest Drupal from CVS
cvs up # make sure I have the most recent changes
cvs diff -up > menu-default.patch # generate the actual patch

However!

That said, I manually fixed the line in question and tried your changes and looks like it's working great! So just do a re-roll of this sucker and it should be ready to go. :)

Jody Lynn’s picture

Status: Needs work » Needs review
FileSize
1.96 KB

Thanks for all the help webchick! New patch.

blackdog’s picture

Status: Needs review » Reviewed & tested by the community

Last patch looks good, applies cleanly and works great.

Gábor Hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Agreed, committed, thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.