Add support for configurable image styles in Section Library thumbnails

Created on 25 November 2024, 27 days ago

Problem/Motivation

Currently, Section Library uses the original uploaded image to display section thumbnails. This behavior lacks flexibility, as users cannot select or configure an image style. To address this, we propose introducing a configuration option that allows administrators to select an image style for section thumbnails or opt for the original image (default behavior).

  1. Section thumbnails currently display the original uploaded image without applying any image styles.
  2. There is no configuration available to allow administrators to select an image style for better control over the appearance of thumbnails.

Steps to reproduce

  1. Install Section Library.
  2. Add section thumbnails with images.
  3. Note that thumbnails always display the original uploaded image, with no option to use an image style.

Steps to Test

  1. Navigate to Configuration > Content authoring > Section Library Settings.
  2. Select an image style from the dropdown and save.
  3. Verify that section thumbnails render with the selected style.
  4. Test the "None" option to ensure the original image paths are used.

Proposed resolution

Introduce a configuration option in the Section Library settings to allow:

  1. Selecting an existing image style for section thumbnails.
  2. Setting a "None" option to use the original image (default behavior if no style is selected).

Implementation Steps

1. Add configuration form
A new configuration form (SectionLibrarySettingsForm) will be added to let administrators select an image style.

  • All available image styles will be loaded dynamically.
  • A default "None" option will be included for cases where no image style is desired.

2. Update schema definition
The configuration schema will be updated to include the new image_style setting.

3. Modify section thumbnail rendering logic
The logic for rendering section thumbnails in the CustomChooseSectionFromLibraryController will be updated:

Use the configured image style to generate styled image URLs dynamically.
If no style is configured or "None" is selected, fallback to the original image URL.

Remaining tasks

NONE

User interface changes

This issue adds flexibility to the Section Library module by enabling administrators to configure thumbnail rendering. This change will improve customizability and align the module with broader use cases.

API changes

NONE

Data model changes

NONE

πŸ“Œ Task
Status

Active

Version

1.2

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine rolki

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

Merge Requests

Comments & Activities

Production build 0.71.5 2024