Problem/motivation
Example situation:
There are entity bundles which have similar name:
- message
- status_message
(both ends with 'message', it's important).
If we enable some fields from status_message for modifying by action, the bulk action form will fieldsets for both bundles, but should have only for status_message. The fieldset for message is empty though.
When submitting the bulk action form it raises an error
Warning: Invalid argument supplied for foreach() in views_bulk_operations_modify_action_validate() (line 371 of /Users/username/Sites/projectname/sites/all/modules/contrib/views_bulk_operations/actions/modify.action.inc).
Proposed resolution
Change the way how the action check whether bundle is affected by current action config. In _views_bulk_operations_modify_action_get_bundles() function, in this piece of code:
$has_enabled_fields = FALSE;
foreach ($display_values as $key) {
if (strpos($key, $bundle_name . '::') !== FALSE) {
$has_enabled_fields = TRUE;
}
}
Change:
if (strpos($key, $bundle_name . '::') !== FALSE) {
to
if (strpos($key, $bundle_name . '::') === 0) {
.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | views_bulk_operations-2973282-2.patch | 504 bytes | mpolishchuck |
Comments
Comment #2
mpolishchuck commentedHere is a patch, which implements my proposed resolution.
Comment #4
joelpittetI've committed this fix to the latest dev branch. Thank you for patching this.
Comment #6
chris matthews commented