Thank you for a great module!
Problem/Motivation
Error message when enabling insert_responsive_image:
Warning: array_merge(): Expected parameter 2 to be an array, null given in insert_responsive_image_insert_variables() (line 73 of .../modules/insert/modules/insert_responsive_image/insert_responsive_image.module).
It seems there are no variables collected from the call to template_preprocess_responsive_image().
Steps to reproduce
With devel enabled, and error handlers enabled: enable the module, make sure responsive styles exist, enable the insert in a block entity, make sure reponsive styles are made selectable, edit a custom block with the insert enabled, use a responsive style.
Proposed resolution
To remove the error message (but not fixing the issue), it is possible to rewrite lines 72-73 to:
isset($vars['attributes']) ? $vars['attributes'] : [],
isset($responsiveImageVars['attributes']) ? $responsiveImageVars['attributes'] : []
but it is likely some more processing is needed on the responsiveImageVars. Dumping the variable with dpm does not seem to reveal any "attributes" to merge.
Comment | File | Size | Author |
---|---|---|---|
#3 | insert-3176560-responsive_image.patch | 736 bytes | Snater |
Comments
Comment #2
jfranzen CreditAttribution: jfranzen commentedThe way you define the responsive image styles seem to affect this.
With the default styles Narrow and Wide, the src-set attribute is found and set.
However, creating a responsive image style using separate breakpoints and image styles at these breakpoints, the src-set is not defined.
Comment #3
Snater CreditAttribution: Snater commentedThanks for trying out the insert_responsive_image module. Getting things work Insert with the Responsive Image module really depends on feedback, especially since I am not a Drupal power user. :)
Your suggestion seems reasonable. So if that is what's necessary to fix the issue, then let's merge in that change. I attached a patch set that would apply the code as suggested by you.
Comment #5
Neslee Canil Pinto