Stop loading image_style in the theme layer

Created on 13 October 2015, about 9 years ago
Updated 10 October 2022, about 2 years ago

Problem/Motivation

The themes #image_formatter and #image_style are both taking the image style name as argument. Then the image style object is loaded in the theme layer, in preprocess. That's a bad design because puts the loading and validating objects logic in the theme layer. Theme layer should not be in business of loading and validating. These are backend operations. The backend should be responsible of loading, validating and preparing the correct image style to be used by the theme.

Proposed resolution

  1. Deprecate the usage of #image_style theme variable 'style_name' in favour of a new 'style' that will hold the entire image style object. If the deprecated variable 'style_name' will get a non-empty value, that will take precedence in theme preprocess to assure a full BC.
  2. Deprecate the usage of #image_formatter theme variable 'image_style' in favour of a new 'style' that will hold the entire image style object. If the deprecated 'image_style' will get a non-empty value, that will take precedence in preprocess to assure a full BC.
  3. Make core use the new variables.
  4. In 9.0.x drop the deprecated variables. Open a followup for that.

Remaining tasks

Open a 9.0.x followup for removing deprecated variables.

User interface changes

None.

API changes

  • New variable 'style' available to 'image_style' theme.
  • New variable 'style' available to 'image_formatter' theme.

Data model changes

None.

📌 Task
Status

Needs work

Version

11.0 🔥

Component
Image module 

Last updated 10 days ago

Created by

🇷🇴Romania claudiu.cristea Arad 🇷🇴

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.

No activities found.

Production build 0.71.5 2024