Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Looks like the submit handler never gets called, didn't look beyond that yet.
Comment | File | Size | Author |
---|---|---|---|
#9 | 542206.patch | 4.7 KB | asimmonds |
#7 | 542206.patch | 3.68 KB | asimmonds |
#3 | 542206.patch | 4.42 KB | asimmonds |
#1 | 542206.patch | 4.19 KB | asimmonds |
Comments
Comment #1
asimmonds CreditAttribution: asimmonds commentedSomething is funny with the inheritance of the #submit property in the form, I haven't yet been able to figure out what has changed to break this in the core FormAPI.
But, adding #submit properties to each of the buttons appears to work and I've also written a test case for the node administration page and filter functionality.
- Is adding #submit to each button the way to go?
- Should node_filter_form_submit() be split up into smaller _submit functions to remove the 'op' switch?
Comment #2
asimmonds CreditAttribution: asimmonds commentedComment #3
asimmonds CreditAttribution: asimmonds commentedComment #4
pamelad CreditAttribution: pamelad commentedI'm reviewing this patch...
Comment #5
pamelad CreditAttribution: pamelad commentedI applied the test, and it worked, as well as the SimpleTests. I tested the filter on admin/content and am getting the correct results back. This forcibly adds the submit function to the buttons, so that seems fine to me. I don't see a reason to split up the node_filter_form_submit() function, so this patch looks good to go.
Comment #6
webchickGreat! Those tests successfully fail (heh ;)) when the first hunk is not applied.
Some minor nitpicks, and then this is good to go.
I don't understand why this wasn't sufficient. Could you place a one-liner above the button array definitions that explains why we're doing #submit at the button level rather than the form level? I could see someone trying to "optimize" this later.
Elsewhere we use $web_user to refer to an un-privileged user, and $admin_user to refer to an administrator. "administer nodes" is a pretty big permission, so I'd rename to $admin_user.
Please add a line of PHPDoc here.
Could we use sensible placeholders here rather than %a and %b?
I'm on crack. Are you, too?
Comment #7
asimmonds CreditAttribution: asimmonds commentedI've figured out the actual cause of this bug. As a result of #394702: Admin/content/node should have a create content link, the filter form was moved down one level in the page form array hierarchy. ie
$form = node_filter_form();
to$form[] = node_filter_form();
.This moved the #submit property for the filter form from
$form['#submit']
to$form[0]['#submit']
.It appears that a form (ie non-button) #submit property can only be located at the root level of the form array.
Well, that was copy/pasted directly from node_filter_form():
Should this be rectified as well?
Instead of inserting button-level submit handlers, just moving the #submit from node_filter_form() to node_admin_content() works as well.
Comment #8
asimmonds CreditAttribution: asimmonds commentedComment #9
asimmonds CreditAttribution: asimmonds commentedHow about changing %a to %type and %b to %value.
Patch has these changes for the test and the original code in node_filter_form()
Comment #10
catchLooks better, back to RTBC.
Comment #11
webchickGreat, thanks a lot! Committed to HEAD. :)