- Issue created by @Rudi Teschner
- 🇩🇪Germany Rudi Teschner
I don't know the reason why it happens yet. But I've found a workaround by patching core for fields related to this module.
If the exception handling is removed for fields related to this module it does the trick - no exceptions thrown. Though I don't know why the exception handling causes the problems though - or rather brings the problems to light?
diff --git a/core/modules/layout_builder/src/Plugin/Block/FieldBlock.php b/core/modules/layout_builder/src/Plugin/Block/FieldBlock.php index 4318ebee24..4d3fe0a698 100644 --- a/core/modules/layout_builder/src/Plugin/Block/FieldBlock.php +++ b/core/modules/layout_builder/src/Plugin/Block/FieldBlock.php @@ -160,21 +160,32 @@ public function build() { $display_settings = $this->getConfiguration()['formatter']; $display_settings['third_party_settings']['layout_builder']['view_mode'] = $this->getContextValue('view_mode'); $entity = $this->getEntity(); - try { + + if ($display_settings['type'] == 'editablefields_formatter') { $build = []; $view = $entity->get($this->fieldName)->view($display_settings); if ($view) { $build = [$view]; } } - // @todo Remove in https://www.drupal.org/project/drupal/issues/2367555. - catch (EnforcedResponseException $e) { - throw $e; - } - catch (\Exception $e) { - $build = []; - $this->logger->warning('The field "%field" failed to render with the error of "%error".', ['%field' => $this->fieldName, '%error' => $e->getMessage()]); + else { + try { + $build = []; + $view = $entity->get($this->fieldName)->view($display_settings); + if ($view) { + $build = [$view]; + } + } + // @todo Remove in https://www.drupal.org/project/drupal/issues/2367555. + catch (EnforcedResponseException $e) { + throw $e; + } + catch (\Exception $e) { + $build = []; + $this->logger->warning('The field "%field" failed to render with the error of "%error".', ['%field' => $this->fieldName, '%error' => $e->getMessage()]); + } } + CacheableMetadata::createFromRenderArray($build)->addCacheableDependency($this)->applyTo($build); return $build; }