What are the steps required to reproduce the bug?
- Enable the Menu module
- Create a new content type
- Click Menu settings
- Click Provide a link menu checkbox and fill in the form
- Preview the form
What behavior were you expecting?
When the form returns I would expect to see the Provide a link menu checkbox checked and the form exposed to be visible with the fields populated with user input.
What happened instead?
The form returns with the Provide a link menu checkbox unchecked. Checking it exposes the form and it's still populated with the user input.
Personal request: This is my first issue report (I think) and first patch. At least against a core module. Any feedback on how I've laid out the issue would be appreciated. Things I've done right, done wrong, where I need to provide more info etc.
Thanks to webchick for the issue queue tutorial session at last nights D7 hackfest at DrupalSouth too.
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | menu-and-path-keep-node-values-with-preview.patch | 4 KB | JoeMcGuire |
| #8 | menu.module.patch | 910 bytes | gold |
| #2 | menu.module.patch | 909 bytes | gold |
Comments
Comment #1
goldThere should probably be a test for this. I'm still getting my head around the test system though.
Comment #2
goldHmm... I could have sworn the patch was attached already...
Here it is.
I also don't appear to be able to edit the node. Am I missing something?
Comment #4
goldLooking at the error that caused the test failure it appears to be completely unrelated to my patch. It was a mysql test failure that bounced it when I don't touch anything db related at all.
Re-testing. Hopefully this is the correct process.
I'm assuming I'm reading the test result page correctly. Is there a handbook page on re-testing? When to submit etc?
Comment #5
gold#2: menu.module.patch queued for re-testing.
Comment #6
Bevan commentedComments should be full sentences and thus start with a capital and end with a full stop. The second sentence would have no meaning to a future reader. Remove it?
I think this should be
if ($form_state['values'] and $form_state['values']['menu'] and $form_state['values']['menu']['enabled']) {Some-most of the testbot errors are because the function is called even when
$form_state['values']is not set (See "Undefined index: 'values'" in the test report). And I don't believe the== 1comparison is necessary — though I may be mistaken.Similarly I don't think (int) or (bool) are necessary for a checkbox's #default_value. I'm pretty sure that not both are necessary, unless they didn't work without them?
Comment #7
Bevan commentedComment #8
goldThanks for that Bevan.
Let's see how this one goes.
Comment #9
Bevan commentedLooks good. Sorry I didn't come back sooner. Another thought;
can be simplified to
since we know it's value.
Comment #10
BenVercammen commentedInstead of reporting a related issue, I'm going to "hijack" this one...
I had "Preview" required for a custom content type (basic title + body + 1 custom field) and before clicking the Preview button, I had set a URL alias (URL path settings). After saving it, I noticed the alias wasn't created because the alias value wasn't stored when hitting the Preview button.
After checking this issue, I found out that "Menu settings" and "URL path settings" did not keep their values when hitting Preview (unless an error was triggered, eg: when also changing the "Authoring information" to a non-existing user). The "Authoring information" and "Publishing options" settings are always being stored.
This leads me to believe that certain modules (Menu and Path in this case) seem to have the same problem, and it's not just tied to one single module.
(As much as I'd like to hit the "Preview" button on this comment, I'm just going to go for "Save" for now ;))
Edit: I just downloaded the drupal-7.x-dev this morning (don't know if that helps)
Comment #11
JoeMcGuire commentedI can confirm then same issue as Ben on head.
For the path and menu modules I've changed the code in their respective hook_form_alter() to check if an updated $node is available in $form_state and if so use that to fill in default values.
Comment #12
Bevan commentedJoe, please create a new issue node for you patch so that the original issue and patch from comment #8 is not lost. Thanks.
Comment #13
retester2010 commented#11: menu-and-path-keep-node-values-with-preview.patch queued for re-testing.