[4.x] Unify image:field_image_caption to image:field_caption

Created on 12 April 2023, over 1 year ago
Updated 8 May 2024, 8 months ago

Problem/Motivation

For historical reasons, media types

  • image
  • vector_image
  • slide (Different label here: "Overlay-Text" and this is widely used!)

still have an old "field_image_caption" field, while luckily all other media types already have the general "field_caption".

We should add "field_caption" where "field_image_caption" was existing before and migrate the values over.
Something like this could work: https://atendesigngroup.com/articles/programmatically-copy-field-data-dr...
Afterwards remove field_image_caption.

The update script needs to perform the following tasks for the affected media types:

  1. Check if field_caption already exists. If no, create it as a copy of field_image_caption. If it already exists, skip this steps (this is the case in our preset). The new field should have the same weight as the old field in form and display. [field / config migration]
  2. Loop all entities of the affected media types and check if both field_image_caption and field_caption exist on the media type. If yes, copy the values from field_image_caption to field_caption [data migration]
  3. If field_image_caption exists, remove it. [cleanup]
  4. We'll also have to re-check the config ymls here, once this is ready, I guess in the last config export I accidentally kept field_image_caption

The changes also have to be reflected in templates!

Also we should solve this in combination: [4.x] Add field_caption for Documents Needs work
Additionally (but only slightly related): Add "Licence / Source" field to all media entities Active

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

📌 Task
Status

Needs work

Version

4.0

Component

Code

Created by

🇩🇪Germany Anybody Porta Westfalica

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

Comments & Activities

Production build 0.71.5 2024