Closed (cannot reproduce)
Project:
Drupal core
Version:
7.x-dev
Component:
comment.module
Priority:
Minor
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
16 Sep 2010 at 10:39 UTC
Updated:
12 Jan 2011 at 11:37 UTC
Jump to comment: Most recent file
Comments
Comment #1
grendzy commentedlooks good to me.
Comment #2
sunThis looks very odd (and ugly). I'd like to know
1) why 'comments' is not an array in the first place.
2) why we need array_diff() here at all.
And finally,
3) why we output a form to update comments if there are no comments.
Powered by Dreditor.
Comment #3
rayasa commentedThank you sun.
form_state['values']['comments'] is set to ' ' when the tableselect is empty unless the property #default_value is defined as array(). The following addition does work unless this isn't the right approach.
Here, the use of array_diff() is similar to array_filter without a callback. It returns an array of selected options in the tableselect and drops those set to '0' (unchecked). Why not use array_filter? Not sure !!
This is a question of consistency across the drupal platform. If we are ready to disable update options or disable the form altogether in case there are no items in tableselect for /admin/content, /admin/content/comment, /admin/people and don't know where else then I am for it !
Comment #4
gagarine commentedBy curiosity, why adding a '#default_value' => array() is not the right approach?
Comment #5
rayasa commentedIMO this is the right approach. I looked into the bug more deeply only after the question came up that why comments is not an array and suggested a correction in #3.
Resubmitting the patch with changes as per #3...
Comment #7
rayasa commentedretrying...
Comment #8
sunre: 3) So we always output those filter and update forms on node/comment admin pages - even if there is nothing to filter or update...?
Comment #9
joachim commentedI don't get a PHP error, I get a drupal warning:
Error message
Select one or more comments to perform the update on.
Which seems reasonable to me.
> re: 3) So we always output those filter and update forms on node/comment admin pages - even if there is nothing to filter or update...?
Indeed, that is silly, but it's maybe less important to fix before release :)
Comment #10
Tor Arne Thune commented#7: 913322.patch queued for re-testing.
Comment #11
droplet commented@joachim & me both have no errors. maybe fixed in somewhere..