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.
If the region ends up empty, you'll get an error since $block_data[$block_key] isn't an array.
Comment | File | Size | Author |
---|---|---|---|
#4 | ds_empty_region_to_block_2.patch | 538 bytes | victoriachan |
ds_empty_region_to_block.patch | 523 bytes | attiks |
Comments
Comment #1
attiks CreditAttribution: attiks commentedBTW error is Fatal error: Unsupported operand types in /sites/all/modules/ds/modules/ds_extras/ds_extras.module on line 230
Comment #2
swentel CreditAttribution: swentel commentedCommitted and pushed, thanks!
Comment #4
victoriachan CreditAttribution: victoriachan commentedThanks for the earlier fix, and thanks for committing it so promptly.
But when my custom ds region is empty, the
$block_data[$block_key]
variable is not only not an array, it is not set, and hence triggering this Drupal notice:Notice: Undefined index: page_sidebar_top_ds in ds_extras_field_attach_view_alter() (line 218 of /private/var/www/drupal7-test/sites/all/modules/ds/modules/ds_extras/ds_extras.module).
I know that I can just set my php.ini to ignore such notices, but it is probably better to fix it in the code since this is a valid complaint.
Proposed fix is to add an additional isset to check if the variable is set:
if (isset($block_data[$block_key]) && is_array($block_data[$block_key])) {
$block_data[$block_key] += $properties;
}
Patch attached (to be applied over the latest 7.x-1.x-dev / 7.x-1.4 with the previous patch already commited).
Comment #5
kreatIL CreditAttribution: kreatIL commentedJust tried out the patch posted by victoriachan (#4). Since it is very helpful I would appreciate it to be commited.
Comment #6
swentel CreditAttribution: swentel commentedCommitted and pushed, thanks!
Comment #8
kreatIL CreditAttribution: kreatIL commentedAfter installing the update to 7.x-1.5 today, the error messages went back. Manually re-patching (#4) ds_extras.module made the error go away again.
Comment #9
swentel CreditAttribution: swentel commentedAh crap, somehow, this didn't got in, sorry about that :/ Pushed and committed.
Comment #10
kreatIL CreditAttribution: kreatIL commentedNever mind! Thx for finally committing :)
Comment #12
aschiwi CreditAttribution: aschiwi commentedThanks for the patch :)