[5.x] Make Photoswipe work with any ContentEntity entity type

Created on 20 June 2024, 3 months ago
Updated 25 July 2024, about 1 month ago

Problem/Motivation

The photoswipe field formatter works fine with multi-value entity_reference fields associated with a media entity, but lacks support for paragraphs, ECK, and other content-based entities.

Context: specifically, we are storing images inside Paragpaphs. Now migrated on 5.x. Before we used custom twig templates to make Photoswipe 3.x work with referenced Paragpaph.

Proposed resolution

1. Introduce support for other entity types within ImageDTO class.
2. Ensure that photoswipe_dynamic_caption can provide tokens based on referenced entity.
3. Allow photoswipe*_entity_field_formatter to work with entity_reference_revisions field type.

Remaining tasks

- Merge ✨ [5.x] Separate image and entity_reference formatters Needs work
- Adjust photoswipe_entity_field_formatter, photoswipe_responsive_entity_field_formatter with adding entity_reference_revisions for field_types
- Ensure ImageDTO store correct $this->item when ContentEntity entity received from $variables.
- Ensure photoswipe_dynamic_caption module can build custom tokens based on entity that hosts an image field ( πŸ’¬ Dynamic caption: How to use a dedicated caption field on a media entity? Needs review )!
- Write hook updates to assoc entity_reference_revisions field type with correct formatter.

User interface changes

User can select Photoswipe field formatter for entity reference fields linked to ContentEntity entity, like: Paragrpaph, ECK, etc.

API changes

-

Data model changes

ImageDTO::item can contain a ContentEntity entity .

✨ Feature request
Status

Active

Version

5.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine vlad.dancer Kyiv

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024