styles_default_presets merging at container level, wouldn't it be better recursive merging?

Created on 6 July 2011, almost 14 years ago
Updated 11 June 2025, 2 days ago

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.

✨ Feature request
Status

Closed: outdated

Version

2.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain jmones

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States bluegeek9

    Thank you for your contributions to this issue. As Drupal 7 has reached its End of Life and is no longer supported, we are closing this issue. We encourage you to upgrade to a supported version of Drupal.

Production build 0.71.5 2024