Problem/Motivation

  1. #3059480: Embedded media entities using a view mode have captions that look broken introduced the entity_embed/caption asset library and attaches it automatically.
  2. It cannot be attached only when the @Filter=filter_caption filter is enabled, because filters do not know which other filters run
  3. Therefore it must always be attached when @Filter=entity_embed renders an embedded entity
  4. … but today it doesn't check that rendering an embedded entity actually resulted in something being rendered; an entity inaccessible to the current user renders to the empty string and hence there's also no caption, so also no need to attach the asset library.

(Discovered this while working on #3052482: Expand EntityEmbedFilter's test coverage: test many more edge cases, change to kernel test.)

Proposed resolution

Only attach the entity_embed/caption asset library when there actually is an embedded entity.

Remaining tasks

None.

User interface changes

None.

API changes

None.

Data model changes

None.

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Status: Active » Needs review
StatusFileSize
new1.15 KB
wim leers’s picture

Title: Only attach `entity_embed/caption` when an entity was actually output » Only attach `entity_embed/caption` asset library when an entity was actually rendered
wim leers’s picture

StatusFileSize
new1.08 KB
new2.18 KB

Let's make it happen.

wim leers’s picture

StatusFileSize
new2.21 KB
new3.12 KB

Let's not hardcode knowledge about the expectations in the test method, that's what the data provider is for!

The last submitted patch, 2: 3063801-2-FAIL.patch, failed testing. View results

wim leers’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Media Initiative

Green, simple, 🚀

  • Wim Leers committed 9e5aeca on 8.x-1.x
    Issue #3063801 by Wim Leers: Only attach `entity_embed/caption` asset...
wim leers’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.