Closed (fixed)
Project:
Drupal core
Version:
7.x-dev
Component:
forms system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
21 May 2012 at 00:52 UTC
Updated:
4 Jan 2014 at 02:05 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
sunSorry, forgot the totally important detail about also having custom #parents on the $form itself.
Comment #2
sunDiscussed with @chx that enforcing explicit #parents is better than #tree FALSE.
We also discussed whether the other form processing/validation code shouldn't rather check for $form['form_token']['#value'] instead of relying on submitted form values, but that would inherently add a dependency on the $form structure. Out of the two choices, enforcing #parents made more sense.
Comment #3
chx commentedGood to go.
Comment #4
dries commentedI reviewed this patch but it was not 100% clear. Given that both chx and sun approved it, and that all tests pass, I committed it anyway.
Comment #5
tim.plunkettRerolled.
Comment #6
sunThanks!
Comment #7
David_Rothstein commentedI had trouble getting my head around this one too. Ultimately, I think it just comes down to the fact that there's lots of code in the form API that looks for these things in the top level of $form_state['input'] or $form_state['values'], so we need to ensure that they will actually always be in the top level.
Out of curiosity, why? I would have found this code a lot easier to understand with #tree set to FALSE, because that's the standard way to accomplish the above. Is the concern that someone altering the form might be likely to change #tree by accident?
Anyway, this patch works fine as is, so although it seems like there might be room for a followup to clarify the code comments, etc.... I committed it to 7.x. Thanks!
http://drupalcode.org/project/drupal.git/commit/121b348
Comment #8.0
(not verified) commentedUpdated issue summary.