- Issue created by @rclemings
I'm still seeing a disappearing-captions case that doesn't appear to be fixed by #3184748. It's happening with nodes that have a draft/needs review/published workflow using core content moderation.
I'm also seeing an issue with captions disappearing from the form when a node is opened for editing. A cache rebuild seems to bring them back, but that option isn't going to be available to all content authors. I've worked around it for now with some custom code that loads the caption from the database when it is missing from the form.
1. On a site using core content moderation, publish an entity with images and captions.
2. Open the node and save it as a draft. This creates a new revision, visible on the "latest version" tab.
3. The new revision has its captions. But the previous revision, which is still published, does not. That caption was deleted at lines 227-229 of image_field_caption.module.
// Delete the caption associated to this field.
$imageCaption->deleteCaption($entity->getEntityTypeId(), $entity->bundle(), $field_name, $entity->id(), $entity->language()
->getId());
One partial solution I found, not optimal, was to delete the above line ($imageCaption->deleteCaption) and add the revision id to the primary index of the image_field_caption table. One obvious side effect is that the table bloats with outdated captions. And even that solution seems to work only for the first workflow transition, not subsequent ones, as far as I can see.
Active
2.0
Code