diff --git a/src/EventSubscriber/ComponentPluginTranslate.php b/src/EventSubscriber/ComponentPluginTranslate.php index 34cbf57..2344844 100644 --- a/src/EventSubscriber/ComponentPluginTranslate.php +++ b/src/EventSubscriber/ComponentPluginTranslate.php @@ -82,10 +82,14 @@ final class ComponentPluginTranslate implements EventSubscriberInterface { $section_storage = $this->routeMatch->getParameter('section_storage'); } else { - $section_storage = $this->getSectionStorageForEntity($entity); + $view_mode = NULL; + if (isset($contexts['view_mode'])) { + $view_mode = $contexts['view_mode']->getContextValue(); + } + $section_storage = $this->getSectionStorageForEntity($entity, $view_mode); } - if (static::isTranslation($section_storage)) { + if ($section_storage && static::isTranslation($section_storage)) { if ($translated_plugin_configuration = $section_storage->getTranslatedComponentConfiguration($component->getUuid())) { $translated_plugin_configuration += $configuration; $plugin->setConfiguration($translated_plugin_configuration);