Better compatibility with media filter (WYSIWYG related)

Created on 27 May 2011, about 14 years ago
Updated 11 June 2025, 2 days ago

There are some efforts ( #1043570: Floating images left and right β†’ and #1094016: Allow Wysiwyg styles β†’ ) to improve the WYSIWYG functionalities in Media and Styles modules.

I have been analyzing both module's code, and I think that styles does not handle correctly the integration in that case.

Media filter adds the possibility to insert media fields (with its own syntax) embebed in any text input. The most common usecase of this is in node's body fields combined with WYSIWYG.

When a node is saved (node_save) the textinput filled by the user is processed by all the input filters and results in two different values: value (as it's been introduced) and safe_value (as it's been processed by the filters configured). Nodes afterwords, to improve perfomance, are cached internally so safe_value is no longer generated till the next time node is being rendered and caches have been cleared previously.

The problem is that when media processes the raw value it uses styles module styles_field_formatter_view function to render the information, which uses itself a call to a theme function that could be overwritten by any theme.

This has no sense, because it is processed just a time and in most cases by the administrator which has a different theme than the rest of the users. So when the node is rendered with an anononymous user who has a different theme, the field will be rendered with the template (sytles.tpl.php) of the administration theme.

There are two different solutions:

  • the best one, in my opinion, is not to process the raw value in styles module with a theme function
  • to change the translation of the raw value from hook_filter_info to a hook_node_view, which could have theme functions, but in my opinion is much harder to implement once both modules have achieved this stability

I would have liked to attach a patch, but my knowledge of styles module architecture is not good enough.

✨ Feature request
Status

Closed: outdated

Version

2.0

Component

Code

Created by

πŸ‡ͺπŸ‡ΈSpain jherencia

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