- Issue created by @GΓ‘bor Hojtsy
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
Layout Builder rethrows this exception in
Drupal\layout_builder\Plugin\Block\FieldBlock
to allow for this flow to work.Indeed, but it points to a core issue too:
// @todo Remove in https://www.drupal.org/project/drupal/issues/2367555. catch (EnforcedResponseException $e) { throw $e; }
π
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
it submits fine but on submission, XB catches the EnforcedResponseException and that leads to failed rendering of the component:
This sounds related to π ComponentSourceInterface::submitConfigurationForm and validateConfigurationForm are never called Active , but it's possible that just adding the
catch
when building block plugins is sufficient? π€Can you give this a try?
.../ExperienceBuilder/ComponentSource/BlockComponent.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Plugin/ExperienceBuilder/ComponentSource/BlockComponent.php b/src/Plugin/ExperienceBuilder/ComponentSource/BlockComponent.php index f0a7b094c..6921a97e2 100644 --- a/src/Plugin/ExperienceBuilder/ComponentSource/BlockComponent.php +++ b/src/Plugin/ExperienceBuilder/ComponentSource/BlockComponent.php @@ -16,6 +16,7 @@ use Drupal\Core\Cache\CacheableMetadata; use Drupal\Core\Config\TypedConfigManagerInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Entity\FieldableEntityInterface; +use Drupal\Core\Form\EnforcedResponseException; use Drupal\Core\Form\FormStateInterface; use Drupal\Core\Link; use Drupal\Core\Plugin\ContainerFactoryPluginInterface; @@ -212,7 +213,14 @@ final class BlockComponent extends ComponentSourceBase implements ContainerFacto return $build; } - $build['content'] = $block->build(); + try { + $build['content'] = $block->build(); + } + // @todo Remove in https://www.drupal.org/project/drupal/issues/2367555. + catch (EnforcedResponseException $e) { + throw $e; + } + if (Element::isEmpty($build['content'])) { return $build; }
- ππΊHungary GΓ‘bor Hojtsy Hungary
I tried that, thanks, but that did not seem to change anything.
From what I see
src/Element/RenderSafeComponentContainer.php
is where the logging comes from which catches all throwables:public function renderComponent(array $element): array { $context = new RenderContext(); $element['#children'] = $this->renderer->executeInRenderContext($context, function () use (&$element, $context) { try { return $this->renderer->render($element['#component']); } catch (\Throwable $e) {
So I think re-throwing it will still make it end up here and caught wholesale.