@@ -179,7 +179,7 @@ |
||
| 179 | 179 | ]); |
| 180 | 180 | //Remove the data-* prefix for each key |
| 181 | 181 | $data = array_combine( |
| 182 | - array_map(function ($key) { |
|
| 182 | + array_map(function($key) { |
|
| 183 | 183 | if (strpos($key, 'data-') === 0) { |
| 184 | 184 | return substr($key, 5); |
| 185 | 185 | } |
@@ -60,13 +60,13 @@ |
||
| 60 | 60 | // This options allows you to override the currency shown for the null value |
| 61 | 61 | $resolver->setDefault('base_currency', null); |
| 62 | 62 | |
| 63 | - $resolver->setDefault('choice_attr', function (Options $options) { |
|
| 64 | - return function ($choice) use ($options) { |
|
| 63 | + $resolver->setDefault('choice_attr', function(Options $options) { |
|
| 64 | + return function($choice) use ($options) { |
|
| 65 | 65 | return $this->choice_helper->generateChoiceAttrCurrency($choice, $options); |
| 66 | 66 | }; |
| 67 | 67 | }); |
| 68 | 68 | |
| 69 | - $resolver->setDefault('empty_message', function (Options $options) { |
|
| 69 | + $resolver->setDefault('empty_message', function(Options $options) { |
|
| 70 | 70 | //By default we use the global base currency: |
| 71 | 71 | $iso_code = $this->base_currency; |
| 72 | 72 | |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | { |
| 92 | 92 | $tmp = $this->generateChoiceAttr($choice, $options); |
| 93 | 93 | |
| 94 | - if(!empty($choice->getIsoCode())) { |
|
| 94 | + if (!empty($choice->getIsoCode())) { |
|
| 95 | 95 | $symbol = Currencies::getSymbol($choice->getIsoCode()); |
| 96 | 96 | } else { |
| 97 | 97 | $symbol = null; |
@@ -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, $options); |
| 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', |