Setting up a Contact form for your Drupal site already takes about 9 steps too long as it is, but one of the things that makes it even longer is having to enable the "Contact" menu item first from the list at admin/build/menu, and then move it to Primary Links in the edit page.

If the menu item edit screen had the "Enabled" checkbox, we could do everything from one page.

Comments

Nick Lewis’s picture

Assigned: Unassigned » Nick Lewis

+1 to killing that minor annoyance (which over the course of years has taken away hours of my time).

patchnewbie’s picture

This would be a good patch for someone new to core development.

Nick Lewis’s picture

Status: Active » Needs review
StatusFileSize
new1.19 KB

Anyone have a clue why -- regardless of the ordering of form elements -- this checkbox is floating to the very top?

That said, if we're cool with it showing up at the top of the form, and avoiding explaining what a disabled menu item will do in all circumstances than I think this is ready.

***

As for documenting what this checkbox does, I think we'd need a paragraph to explain the caveats (so I avoided it...). The caveats include and are not limited to: admin vs regular users being able to access the page that the menu item refers to (and the different behavior between a system menu item vs a custom item), what happens to child elements if a parent is disabled, and the menu is collapsed, vs expanded etc...

jody lynn’s picture

StatusFileSize
new2.07 KB

I found why it was coming up too high (it was already being created as a hidden 'value' field) and fixed that. Also added a basic description to match description depth of other fields.

Nick Lewis’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new1.84 KB

Thanks Lynn, with that I think this small patch is ready to be committed. Made a small change to the ordering of the form elements, placing the enabled checkbox directly above the expanded checkbox.

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Needs work

Hrm, why not call the form item 'enabled' then and reverse that to 'hidden'? Having two different meanings for hidden seems to be bad to me.

Nick Lewis’s picture

Status: Needs work » Needs review
StatusFileSize
new1.89 KB

Good point. Rerolled the patch.

jody lynn’s picture

Status: Needs review » Reviewed & tested by the community

Tested patch.

gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

I slightly edited the patch for coding style to get to this:

  // The value of "hidden" is the opposite of the value
  // supplied by the "enabled" checkbox. 
  $item['hidden'] = (int) !$item['enabled'];
  unset($item['enabled']);

and committed. Thanks.

Nick Lewis’s picture

I knew there was a better way! Thx for the tip.

Anonymous’s picture

Status: Fixed » Closed (fixed)

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