Skip to content

Commit 19a1037

Browse files
authored
add channel context handling to FunnelWorker, render _token in funnel… (#519)
1 parent 0cf9c96 commit 19a1037

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

UPGRADE.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Upgrade Notes
22

3+
## 5.3.1
4+
- **[BUGFIX]** [FUNNEL] Add channel context handling to FunnelWorker [#518](https://github.com/dachcom-digital/pimcore-formbuilder/issues/518)
5+
- **[BUGFIX]** [FUNNEL] Render `_token` in funnel base template if available and renderable
6+
37
## 5.3.0
48
- **[IMPROVEMENT]** New field added to `form_builder_form_attributes`: `autocomplete`
59
- **[BUGFIX]** Solidify check for empty value in output transformer [#486](https://github.com/dachcom-digital/pimcore-formbuilder/issues/508)

src/OutputWorkflow/FunnelWorker.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
use FormBuilderBundle\Model\FunnelActionElement;
2424
use FormBuilderBundle\Model\OutputWorkflowChannelInterface;
2525
use FormBuilderBundle\Model\OutputWorkflowInterface;
26+
use FormBuilderBundle\OutputWorkflow\Channel\ChannelContext;
27+
use FormBuilderBundle\OutputWorkflow\Channel\ChannelContextAwareInterface;
2628
use FormBuilderBundle\OutputWorkflow\Channel\ChannelResponseAwareInterface;
2729
use FormBuilderBundle\OutputWorkflow\Channel\Funnel\Action\FunnelActionElementStack;
2830
use FormBuilderBundle\OutputWorkflow\Channel\FunnelAwareChannelInterface;
@@ -164,13 +166,19 @@ protected function processDataFunnel(FunnelWorkerData $funnelWorkerData): Respon
164166
$dataChannelResponse = null;
165167
$channelProcessor = $funnelWorkerData->getChannelProcessor();
166168

169+
$channelContext = new ChannelContext();
170+
167171
try {
168172
$arguments = [
169173
$funnelWorkerData->getSubmissionEvent(),
170174
$funnelWorkerData->getOutputWorkflow()->getName(),
171175
$funnelWorkerData->getChannel()->getConfiguration()
172176
];
173177

178+
if ($channelProcessor instanceof ChannelContextAwareInterface) {
179+
$channelProcessor->setChannelContext($channelContext);
180+
}
181+
174182
if ($channelProcessor instanceof ChannelResponseAwareInterface) {
175183
$dataChannelResponse = $channelProcessor->dispatchResponseOutputProcessing(...$arguments);
176184
} else {

src/Registry/ConditionalLogicRegistry.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@ public function register(string $identifier, mixed $service, ?string $type = nul
4646

4747
if (!is_null($service)) {
4848
$interfaceReference = $type . 'Interface';
49+
/* @phpstan-ignore-next-line */
4950
if (!in_array($this->{$interfaceReference}, class_implements($service), true)) {
5051
throw new \InvalidArgumentException(
52+
/* @phpstan-ignore-next-line */
5153
sprintf('%s needs to implement "%s", "%s" given.', get_class($service), $this->{$interfaceReference}, implode(', ', class_implements($service)))
5254
);
5355
}

templates/funnel/base.html.twig

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
{{ view|raw }}
1717
{% endif %}
1818

19+
{% if form._token is defined and not form._token.isRendered %}
20+
{{ form_widget(form._token) }}
21+
{% endif %}
22+
1923
{{ form_end(form, {render_rest: formRenderRest}) }}
2024

2125
{% endblock funnel_content %}

0 commit comments

Comments
 (0)