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