@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | |
| 73 | 73 | public function buildForm(FormBuilderInterface $builder, array $options): void |
| 74 | 74 | { |
| 75 | - $builder->addEventListener(FormEvents::PRE_SUBMIT, function (PreSubmitEvent $event) { |
|
| 75 | + $builder->addEventListener(FormEvents::PRE_SUBMIT, function(PreSubmitEvent $event) { |
|
| 76 | 76 | //When the data contains non-digit characters, we assume that the user entered a new element. |
| 77 | 77 | //In that case we add the new element to our choice_loader |
| 78 | 78 | |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | }); |
| 91 | 91 | |
| 92 | 92 | $builder->addModelTransformer(new CallbackTransformer( |
| 93 | - function ($value) use ($options) { |
|
| 93 | + function($value) use ($options) { |
|
| 94 | 94 | return $this->modelTransform($value, $options); |
| 95 | - }, function ($value) use ($options) { |
|
| 95 | + }, function($value) use ($options) { |
|
| 96 | 96 | return $this->modelReverseTransform($value, $options); |
| 97 | 97 | })); |
| 98 | 98 | } |
@@ -103,32 +103,32 @@ discard block |
||
| 103 | 103 | $resolver->setDefaults([ |
| 104 | 104 | 'allow_add' => false, |
| 105 | 105 | 'show_fullpath_in_subtext' => true, //When this is enabled, the full path will be shown in subtext |
| 106 | - 'subentities_of' => null, //Only show entities with the given parent class |
|
| 107 | - 'disable_not_selectable' => false, //Disable entries with not selectable property |
|
| 108 | - 'choice_value' => function (?AbstractStructuralDBElement $element) { |
|
| 106 | + 'subentities_of' => null, //Only show entities with the given parent class |
|
| 107 | + 'disable_not_selectable' => false, //Disable entries with not selectable property |
|
| 108 | + 'choice_value' => function(?AbstractStructuralDBElement $element) { |
|
| 109 | 109 | return $this->choice_helper->generateChoiceValue($element); |
| 110 | 110 | }, //Use the element id as option value and for comparing items |
| 111 | - 'choice_loader' => function (Options $options) { |
|
| 111 | + 'choice_loader' => function(Options $options) { |
|
| 112 | 112 | return new StructuralEntityChoiceLoader($options, $this->builder, $this->em); |
| 113 | 113 | }, |
| 114 | - 'choice_label' => function (Options $options) { |
|
| 115 | - return function ($choice, $key, $value) use ($options) { |
|
| 114 | + 'choice_label' => function(Options $options) { |
|
| 115 | + return function($choice, $key, $value) use ($options) { |
|
| 116 | 116 | return $this->choice_helper->generateChoiceLabel($choice); |
| 117 | 117 | }; |
| 118 | 118 | }, |
| 119 | - 'choice_attr' => function (Options $options) { |
|
| 120 | - return function ($choice, $key, $value) use ($options) { |
|
| 119 | + 'choice_attr' => function(Options $options) { |
|
| 120 | + return function($choice, $key, $value) use ($options) { |
|
| 121 | 121 | return $this->choice_helper->generateChoiceAttr($choice, $options); |
| 122 | 122 | }; |
| 123 | 123 | }, |
| 124 | - 'group_by' => function (AbstractStructuralDBElement $element) { |
|
| 124 | + 'group_by' => function(AbstractStructuralDBElement $element) { |
|
| 125 | 125 | return $this->choice_helper->generateGroupBy($element); |
| 126 | 126 | }, |
| 127 | 127 | 'choice_translation_domain' => false, //Don't translate the entity names |
| 128 | 128 | ]); |
| 129 | 129 | |
| 130 | 130 | //Set the constraints for the case that allow add is enabled (we then have to check that the new element is valid) |
| 131 | - $resolver->setNormalizer('constraints', function (Options $options, $value) { |
|
| 131 | + $resolver->setNormalizer('constraints', function(Options $options, $value) { |
|
| 132 | 132 | if ($options['allow_add']) { |
| 133 | 133 | $value[] = new Valid(); |
| 134 | 134 | } |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | $resolver->setDefault('controller', 'elements--structural-entity-select'); |
| 142 | 142 | |
| 143 | - $resolver->setDefault('attr', function (Options $options) { |
|
| 143 | + $resolver->setDefault('attr', function(Options $options) { |
|
| 144 | 144 | $tmp = [ |
| 145 | 145 | 'data-controller' => $options['controller'], |
| 146 | 146 | 'data-allow-add' => $options['allow_add'] ? 'true' : 'false', |