|
14 | 14 | namespace MonsieurBiz\SyliusNoCommercePlugin\Form\Type\Settings; |
15 | 15 |
|
16 | 16 | use MonsieurBiz\SyliusNoCommercePlugin\Firewall\RegistryInterface; |
17 | | -use MonsieurBiz\SyliusNoCommercePlugin\Model\ConfigInterface; |
18 | 17 | use MonsieurBiz\SyliusSettingsPlugin\Form\AbstractSettingsType; |
19 | 18 | use Symfony\Component\Form\Extension\Core\Type\CheckboxType; |
20 | 19 | use Symfony\Component\Form\Extension\Core\Type\ChoiceType; |
@@ -56,35 +55,19 @@ public function buildForm(FormBuilderInterface $builder, array $options): void |
56 | 55 | 'label' => 'monsieurbiz.nocommerce.ui.form.field.enabled.label', |
57 | 56 | 'required' => false, |
58 | 57 | ]); |
59 | | - $this->addWithDefaultCheckbox($builder, 'disabled_firewall_contexts', ChoiceType::class, [ |
60 | | - 'label' => 'monsieurbiz.nocommerce.ui.form.field.disabled_firewall_contexts.label', |
61 | | - 'required' => false, |
62 | | - 'multiple' => true, |
63 | | - 'choices' => $choices, |
64 | | - ]); |
65 | 58 |
|
66 | 59 | if ($this->isDefaultForm($builder)) { |
67 | | - $this->addWithDefaultCheckbox($builder, 'routes_to_enable', ChoiceType::class, [ |
68 | | - 'label' => 'monsieurbiz.nocommerce.ui.form.field.routes_to_enable.label', |
| 60 | + $builder->add('allow_admin', CheckboxType::class, [ |
| 61 | + 'label' => 'monsieurbiz.nocommerce.ui.form.field.allow_admin.label', |
69 | 62 | 'required' => false, |
70 | | - 'multiple' => true, |
71 | | - 'expanded' => false, |
72 | | - 'choices' => $this->getEnabledRouteChoices(), |
73 | 63 | ]); |
74 | 64 | } |
75 | | - } |
76 | | - |
77 | | - private function getEnabledRouteChoices(): array |
78 | | - { |
79 | | - $allRoutes = ConfigInterface::ROUTES_BY_GROUP; |
80 | | - $choices = []; |
81 | 65 |
|
82 | | - foreach ($allRoutes as $group => $routes) { |
83 | | - foreach ($routes as $route) { |
84 | | - $choices[$group][$route] = $route; |
85 | | - } |
86 | | - } |
87 | | - |
88 | | - return $choices; |
| 66 | + $this->addWithDefaultCheckbox($builder, 'disabled_firewall_contexts', ChoiceType::class, [ |
| 67 | + 'label' => 'monsieurbiz.nocommerce.ui.form.field.disabled_firewall_contexts.label', |
| 68 | + 'required' => false, |
| 69 | + 'multiple' => true, |
| 70 | + 'choices' => $choices, |
| 71 | + ]); |
89 | 72 | } |
90 | 73 | } |
0 commit comments