When using imagefield_tokens in conjunction with Layout Builder, I get a whitescreen with this error:
Drupal\Component\Plugin\Exception\ContextException: The entity context is not a valid context. in Drupal\Component\Plugin\ContextAwarePluginBase->getContextDefinition() (line 118 of core/lib/Drupal/Component/Plugin/ContextAwarePluginBase.php).
Drupal\Core\Plugin\ContextAwarePluginBase->getContextDefinition('entity') (Line: 53)
Drupal\Core\Plugin\ContextAwarePluginBase->getContext('entity') (Line: 181)I am rendering a Media reference field in layout builder. The view mode for that media type is using imagefield_tokens. Steps to replicate are nasty. I'm going to post a patch that fixes my problem and should look pretty harmless.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | imagefield_tokens--context-exception--3159163--2.patch | 1.36 KB | danflanagan8 |
Comments
Comment #2
danflanagan8This patch just adds a try/catch block and fixes this bug for me.
Comment #3
danflanagan8Comment #4
ysamoylenko commentedThank you for the patch.
It will be applied soon.
Comment #6
ysamoylenko commented