I noticed that when adding/removing view modes, the form for configuring which view modes ("Allowed Entity Embed Display plugins") is not cleared in the cache, so the changed view modes are not present until you manually rebuild the cache.
From my limited understanding of the cache API, I think we just need to attach the proper cache tag to the form item that renders the display modes. I tried with "config:entity_view_display_list" but it didn't purge the cache when I added a new display mode. It's tough trying to find the proper cache tags to use.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 2828608-5.patch | 1.15 KB | wim leers |
Comments
Comment #2
dave reidThis is an issue with Entity Embed. We are discussing reverting the change that makes each view mode its own option in #2845085: Avoid conflating @EntityEmbedDisplay plugins and view modes which would resolve this issue.
Comment #3
marcoscanoComment #4
wim leersComment #5
wim leersActually, this is just a simple oversight. The problem is that
\Drupal\entity_embed\Plugin\Derivative\ViewModeDeriver's computation is not being invalidated when it should. It should be refreshed whenconfig:entity_view_mode_listis invalidated.This is a problem many plugin derivers face, hence the #3001284: Allow plugin derivers to specify cache tags for their definitions core issue.
But until #3001284 lands, this solves it.
Comment #7
wim leersOnce again, the 3 usual failures that are known in HEAD.
Comment #9
phenaproximaLooks great. Thanks! Committed and pushed.