Skip to content

Commit 8c0f31e

Browse files
authored
update custom channel docs, resolves #493 (#494)
1 parent 5b1899e commit 8c0f31e

File tree

2 files changed

+11
-32
lines changed

2 files changed

+11
-32
lines changed

UPGRADE.md

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

3+
## 5.1.5
4+
- **[BUGFIX]** Update custom channel docs [#493](https://github.com/dachcom-digital/pimcore-formbuilder/issues/493)
5+
36
## 5.1.4
47
- **[BUGFIX]** Allow using double-opt-in variables in placeholder processor
58

docs/OutputWorkflow/12_CustomChannel.md

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,12 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
2626

2727
class MyChannelType extends AbstractType
2828
{
29-
/**
30-
* {@inheritdoc}
31-
*/
32-
public function buildForm(FormBuilderInterface $builder, array $options)
29+
public function buildForm(FormBuilderInterface $builder, array $options): void
3330
{
3431
$builder->add('myConfigField', TextType::class);
3532
}
3633

37-
/**
38-
* {@inheritdoc}
39-
*/
40-
public function configureOptions(OptionsResolver $resolver)
34+
public function configureOptions(OptionsResolver $resolver): void
4135
{
4236
$resolver->setDefaults([]);
4337
}
@@ -58,48 +52,29 @@ use FormBuilderBundle\Form\FormValuesOutputApplierInterface;
5852

5953
class MyChannel implements ChannelInterface
6054
{
61-
/**
62-
* @var FormValuesOutputApplierInterface
63-
*/
64-
protected $formValuesOutputApplier;
65-
66-
public function __construct(FormValuesOutputApplierInterface $formValuesOutputApplier)
55+
public function __construct(protected FormValuesOutputApplierInterface $formValuesOutputApplier)
6756
{
68-
$this->formValuesOutputApplier = $formValuesOutputApplier;
6957
}
7058

71-
/**
72-
* {@inheritdoc}
73-
*/
7459
public function getFormType(): string
7560
{
7661
// you need to create a form type for backend configuration validation.
7762
return MyChannelType::class;
7863
}
7964

80-
/**
81-
* {@inheritdoc}
82-
*/
8365
public function isLocalizedConfiguration(): bool
8466
{
8567
return false;
8668
}
8769

88-
/**
89-
* {@inheritdoc}
90-
*/
91-
public function getUsedFormFieldNames(array $channelConfiguration)
70+
public function getUsedFormFieldNames(array $channelConfiguration): array
9271
{
9372
return [];
9473
}
9574

96-
/**
97-
* {@inheritdoc}
98-
*/
99-
public function dispatchOutputProcessing(SubmissionEvent $submissionEvent, string $workflowName, array $channelConfiguration)
75+
public function dispatchOutputProcessing(SubmissionEvent $submissionEvent, string $workflowName, array $channelConfiguration): void
10076
{
101-
$formConfiguration = $submissionEvent->getFormConfiguration();
102-
$locale = $submissionEvent->getRequest()->getLocale();
77+
$locale = $submissionEvent->getLocale() ?? $submissionEvent->getRequest()->getLocale();
10378
$form = $submissionEvent->getForm();
10479

10580
// Output Transformer (See section "Output Transformer" above).
@@ -112,7 +87,8 @@ class MyChannel implements ChannelInterface
11287
```
11388

11489
## ExtJS Class
115-
You need to register this class via `\Pimcore\Event\BundleManagerEvents::JS_PATHS` Event.
90+
You need to register this class via `\Pimcore\Event\BundleManagerEvents::JS_PATHS` Event.
91+
Make sure, that you've defined a low priority, to allow loading fb resources first!.
11692

11793
```js
11894
pimcore.registerNS('Formbuilder.extjs.formPanel.outputWorkflow.channel.myChannel');

0 commit comments

Comments
 (0)