1 | <?php |
||
29 | final class MatomoTrackerBlockService extends AbstractBlockService implements EditableBlockService |
||
30 | { |
||
31 | public function execute(BlockContextInterface $blockContext, Response $response = null) |
||
32 | { |
||
33 | return $this->renderResponse($blockContext->getTemplate(), [ |
||
34 | 'context' => $blockContext, |
||
35 | 'settings' => $blockContext->getSettings(), |
||
36 | 'block' => $blockContext->getBlock(), |
||
37 | 'statusCode' => null === $response ? 200 : $response->getStatusCode(), |
||
38 | ], $response); |
||
39 | } |
||
40 | |||
41 | public function configureCreateForm(FormMapper $form, BlockInterface $block): void |
||
42 | { |
||
43 | $this->configureEditForm($form, $block); |
||
44 | } |
||
45 | |||
46 | public function configureEditForm(FormMapper $formMapper, BlockInterface $block): void |
||
47 | { |
||
48 | $formMapper->add('settings', ImmutableArrayType::class, [ |
||
49 | 'keys' => [ |
||
50 | ['host', TextType::class, [ |
||
51 | 'required' => false, |
||
52 | 'label' => 'form.label_host', |
||
53 | ]], |
||
54 | ['site', NumberType::class, [ |
||
55 | 'label' => 'form.label_site', |
||
56 | ]], |
||
57 | ['domaintitle', CheckboxType::class, [ |
||
58 | 'label' => 'form.label_domaintitle', |
||
59 | 'required' => false, |
||
60 | ]], |
||
61 | ['nocookies', CheckboxType::class, [ |
||
62 | 'label' => 'form.label_nocookies', |
||
63 | 'required' => false, |
||
64 | ]], |
||
65 | ['donottrack', CheckboxType::class, [ |
||
66 | 'label' => 'form.label_donottrack', |
||
67 | 'required' => false, |
||
68 | ]], |
||
69 | ], |
||
70 | 'translation_domain' => 'Core23MatomoBundle', |
||
71 | ]); |
||
72 | } |
||
73 | |||
74 | public function configureSettings(OptionsResolver $resolver): void |
||
87 | |||
88 | public function validate(ErrorElement $errorElement, BlockInterface $block): void |
||
89 | { |
||
90 | } |
||
91 | |||
92 | public function getMetadata(): MetadataInterface |
||
98 | |||
99 | public function getName(): string |
||
103 | } |
||
104 |