Description

At function styles_default_presets() in styles.module, styles retrieved from hooks by other modules are merged using:

$styles[$field_type]['containers'] = array_merge($containers, $styles[$field_type]['containers']);

I think it would be better to use

array_recursive_merge()

so that some modules can add styles to other modules.

My use case

I've been trying to add some presets to media_youtube, so that I'm able to change size of the embedded player. To do so without patching media_youtube, I've hooked

hook_styles_default_presets()

in a module of mine and add some presets to media_youtube container.

The problem is that my container overrides completely media_youtube's, but I'd like them to merge. I thought about using

hook_styles_default_presets_alter()

but I would need to update data from 'styles_preset_instances' table.

It looks far easier just to make this change.

Thank you for your good work.

Comments

jmones’s picture

s/array_recursive_merge/array_merge_recursive/g