diff --git a/UPGRADE.md b/UPGRADE.md index 3acacadd..84dc7d83 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -1,5 +1,9 @@ # Upgrade Notes +## 5.3.1 +- **[BUGFIX]** [FUNNEL] Add channel context handling to FunnelWorker [#518](https://github.com/dachcom-digital/pimcore-formbuilder/issues/518) +- **[BUGFIX]** [FUNNEL] Render `_token` in funnel base template if available and renderable + ## 5.3.0 - **[IMPROVEMENT]** New field added to `form_builder_form_attributes`: `autocomplete` - **[BUGFIX]** Solidify check for empty value in output transformer [#486](https://github.com/dachcom-digital/pimcore-formbuilder/issues/508) diff --git a/src/OutputWorkflow/FunnelWorker.php b/src/OutputWorkflow/FunnelWorker.php index fdc55602..31d4a422 100644 --- a/src/OutputWorkflow/FunnelWorker.php +++ b/src/OutputWorkflow/FunnelWorker.php @@ -23,6 +23,8 @@ use FormBuilderBundle\Model\FunnelActionElement; use FormBuilderBundle\Model\OutputWorkflowChannelInterface; use FormBuilderBundle\Model\OutputWorkflowInterface; +use FormBuilderBundle\OutputWorkflow\Channel\ChannelContext; +use FormBuilderBundle\OutputWorkflow\Channel\ChannelContextAwareInterface; use FormBuilderBundle\OutputWorkflow\Channel\ChannelResponseAwareInterface; use FormBuilderBundle\OutputWorkflow\Channel\Funnel\Action\FunnelActionElementStack; use FormBuilderBundle\OutputWorkflow\Channel\FunnelAwareChannelInterface; @@ -164,6 +166,8 @@ protected function processDataFunnel(FunnelWorkerData $funnelWorkerData): Respon $dataChannelResponse = null; $channelProcessor = $funnelWorkerData->getChannelProcessor(); + $channelContext = new ChannelContext(); + try { $arguments = [ $funnelWorkerData->getSubmissionEvent(), @@ -171,6 +175,10 @@ protected function processDataFunnel(FunnelWorkerData $funnelWorkerData): Respon $funnelWorkerData->getChannel()->getConfiguration() ]; + if ($channelProcessor instanceof ChannelContextAwareInterface) { + $channelProcessor->setChannelContext($channelContext); + } + if ($channelProcessor instanceof ChannelResponseAwareInterface) { $dataChannelResponse = $channelProcessor->dispatchResponseOutputProcessing(...$arguments); } else { diff --git a/src/Registry/ConditionalLogicRegistry.php b/src/Registry/ConditionalLogicRegistry.php index d9c9c373..0e4a78cf 100644 --- a/src/Registry/ConditionalLogicRegistry.php +++ b/src/Registry/ConditionalLogicRegistry.php @@ -46,8 +46,10 @@ public function register(string $identifier, mixed $service, ?string $type = nul if (!is_null($service)) { $interfaceReference = $type . 'Interface'; + /* @phpstan-ignore-next-line */ if (!in_array($this->{$interfaceReference}, class_implements($service), true)) { throw new \InvalidArgumentException( + /* @phpstan-ignore-next-line */ sprintf('%s needs to implement "%s", "%s" given.', get_class($service), $this->{$interfaceReference}, implode(', ', class_implements($service))) ); } diff --git a/templates/funnel/base.html.twig b/templates/funnel/base.html.twig index ae1fa536..d4ffaa38 100644 --- a/templates/funnel/base.html.twig +++ b/templates/funnel/base.html.twig @@ -16,6 +16,10 @@ {{ view|raw }} {% endif %} + {% if form._token is defined and not form._token.isRendered %} + {{ form_widget(form._token) }} + {% endif %} + {{ form_end(form, {render_rest: formRenderRest}) }} {% endblock funnel_content %} \ No newline at end of file