@@ -40,14 +40,14 @@ discard block |
||
40 | 40 | ->setAllowedTypes('allow_add', 'boolean') |
41 | 41 | ->setAllowedTypes('create_property_path', ['string', 'null']) |
42 | 42 | ->setAllowedTypes('select2_options', 'array') |
43 | - ->setNormalizer('create_property_path', function (Options $options, $value) { |
|
43 | + ->setNormalizer('create_property_path', function(Options $options, $value) { |
|
44 | 44 | if ($options->offsetGet('allow_add') && !$value) { |
45 | 45 | throw new InvalidOptionsException('The options "create_property_path" should be defined when "allow_add" is set to true'); |
46 | 46 | } |
47 | 47 | |
48 | 48 | return $value; |
49 | 49 | }) |
50 | - ->setNormalizer('select2_options', function (Options $options, $value) { |
|
50 | + ->setNormalizer('select2_options', function(Options $options, $value) { |
|
51 | 51 | if ($options->offsetGet('allow_add')) { |
52 | 52 | $value['tags'] = json_encode(true); |
53 | 53 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | public function buildForm(FormBuilderInterface $builder, array $options) |
61 | 61 | { |
62 | 62 | $builder |
63 | - ->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use ($options) { |
|
63 | + ->addEventListener(FormEvents::PRE_SUBMIT, function(FormEvent $event) use ($options) { |
|
64 | 64 | $manager = $this->registry->getManagerForClass($options['class']); |
65 | 65 | $repository = $manager->getRepository($options['class']); |
66 | 66 | $propertyAccessor = PropertyAccess::createPropertyAccessor(); |
@@ -25,7 +25,7 @@ |
||
25 | 25 | 'tinymce_options' => [], |
26 | 26 | ]) |
27 | 27 | ->setAllowedTypes('tinymce_options', 'array') |
28 | - ->setNormalizer('tinymce_options', function (Options $options, $value) { |
|
28 | + ->setNormalizer('tinymce_options', function(Options $options, $value) { |
|
29 | 29 | $attr = $options->offsetGet('attr'); |
30 | 30 | |
31 | 31 | if (\array_key_exists('id', $attr)) { |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | public function getDataTransformer(): ?Closure |
20 | 20 | { |
21 | - return function ($data) { |
|
21 | + return function($data) { |
|
22 | 22 | return is_countable($data) ? \count($data) : 0; |
23 | 23 | }; |
24 | 24 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | |
23 | 23 | public function getDataTransformer(): ?Closure |
24 | 24 | { |
25 | - return function ($data) { |
|
25 | + return function($data) { |
|
26 | 26 | if ($data === null) { |
27 | 27 | return ''; |
28 | 28 | } |
@@ -19,7 +19,7 @@ |
||
19 | 19 | 'template' => '@LAGAdmin/fields/action-collection.html.twig', |
20 | 20 | 'actions' => [], |
21 | 21 | ]) |
22 | - ->setNormalizer('actions', function (Options $options, $value) { |
|
22 | + ->setNormalizer('actions', function(Options $options, $value) { |
|
23 | 23 | if (!\is_array($value) || 0 === \count($value)) { |
24 | 24 | $value = [ |
25 | 25 | 'edit' => [], |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | 'title' => null, |
35 | 35 | 'url' => '', |
36 | 36 | ]) |
37 | - ->setNormalizer('route', function (Options $options, $value) use ($appConfig) { |
|
37 | + ->setNormalizer('route', function(Options $options, $value) use ($appConfig) { |
|
38 | 38 | // A route, an url or an admin should be defined |
39 | 39 | if (!$value && !$options->offsetGet('url') && !$options->offsetGet('admin')) { |
40 | 40 | throw new InvalidOptionsException('Either an url or a route should be defined'); |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | |
47 | 47 | return $value; |
48 | 48 | }) |
49 | - ->setNormalizer('admin', function (Options $options, $value) { |
|
49 | + ->setNormalizer('admin', function(Options $options, $value) { |
|
50 | 50 | // if a Admin is defined, an Action should be defined too |
51 | 51 | if ($value && !$options->offsetGet('action')) { |
52 | 52 | throw new InvalidOptionsException('An Action should be provided if an Admin is provided'); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | |
55 | 55 | return $value; |
56 | 56 | }) |
57 | - ->setNormalizer('text', function (Options $options, $value) { |
|
57 | + ->setNormalizer('text', function(Options $options, $value) { |
|
58 | 58 | if ($value) { |
59 | 59 | return $value; |
60 | 60 | } |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | 'options' => [], |
17 | 17 | ]) |
18 | 18 | ->setAllowedTypes('type', ['string', 'null']) |
19 | - ->setNormalizer('type', function (Options $options, $value) { |
|
19 | + ->setNormalizer('type', function(Options $options, $value) { |
|
20 | 20 | if ($value === null) { |
21 | 21 | $value = 'auto'; |
22 | 22 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | }) |
26 | 26 | |
27 | 27 | ->setAllowedTypes('options', ['array', 'null']) |
28 | - ->setNormalizer('options', function (Options $options, $values) { |
|
28 | + ->setNormalizer('options', function(Options $options, $values) { |
|
29 | 29 | if ($values === null) { |
30 | 30 | return []; |
31 | 31 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | ->setAllowedTypes('permissions', 'string') |
109 | 109 | |
110 | 110 | // Translation |
111 | - ->setDefault('translation', function (OptionsResolver $translationResolver) { |
|
111 | + ->setDefault('translation', function(OptionsResolver $translationResolver) { |
|
112 | 112 | $translationResolver |
113 | 113 | ->setDefault('enabled', true) |
114 | 114 | ->setAllowedTypes('enabled', 'boolean') |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | |
305 | 305 | private function getRoutesPatternNormalizer(): Closure |
306 | 306 | { |
307 | - return function (Options $options, $value) { |
|
307 | + return function(Options $options, $value) { |
|
308 | 308 | if (!u($value)->containsAny('{admin}')) { |
309 | 309 | throw new InvalidOptionsException('The routes pattern should contains "{admin}" placeholder. Given '.$value); |
310 | 310 | } |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | |
320 | 320 | private function getFieldsMappingNormalizer(): Closure |
321 | 321 | { |
322 | - return function (Options $options, $value) { |
|
322 | + return function(Options $options, $value) { |
|
323 | 323 | if (!\is_array($value)) { |
324 | 324 | $value = []; |
325 | 325 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | |
331 | 331 | private function getMenusNormalizer(): Closure |
332 | 332 | { |
333 | - return function (Options $options, $value) { |
|
333 | + return function(Options $options, $value) { |
|
334 | 334 | if ($value === null) { |
335 | 335 | $value = []; |
336 | 336 | } |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | 'extras' => ['safe_label' => true], |
38 | 38 | ]) |
39 | 39 | |
40 | - ->setNormalizer('admin', function (Options $options, $adminName) { |
|
40 | + ->setNormalizer('admin', function(Options $options, $adminName) { |
|
41 | 41 | // The user has to defined either an admin name and an action name, or a route name with optional |
42 | 42 | // parameters, or an url |
43 | 43 | if (null === $adminName |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | return $adminName; |
51 | 51 | }) |
52 | 52 | // if an admin name is set, an action name can provided. This action will be the menu link |
53 | - ->setNormalizer('action', function (Options $options, $action) { |
|
53 | + ->setNormalizer('action', function(Options $options, $action) { |
|
54 | 54 | // if an action name is provided, an admin name should be defined too |
55 | 55 | if (null !== $action && null === $options->offsetGet('admin')) { |
56 | 56 | throw new InvalidOptionsException('You should provide an admin name for this action '.$action); |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | |
64 | 64 | return $action; |
65 | 65 | }) |
66 | - ->setNormalizer('children', function (Options $options, $items) { |
|
66 | + ->setNormalizer('children', function(Options $options, $items) { |
|
67 | 67 | if (!\is_array($items)) { |
68 | 68 | $items = []; |
69 | 69 | } |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | return $resolvedItems; |
79 | 79 | }) |
80 | - ->setNormalizer('text', function (Options $options, $text) { |
|
80 | + ->setNormalizer('text', function(Options $options, $text) { |
|
81 | 81 | if ($options->offsetGet('admin') && !$text) { |
82 | 82 | $text = u($options->offsetGet('admin'))->replace('_', ' ')->title(true); |
83 | 83 | |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | |
99 | 99 | return $text; |
100 | 100 | }) |
101 | - ->setNormalizer('linkAttributes', function (Options $options, $linkAttributes) { |
|
101 | + ->setNormalizer('linkAttributes', function(Options $options, $linkAttributes) { |
|
102 | 102 | if (!$linkAttributes) { |
103 | 103 | $linkAttributes = []; |
104 | 104 | } |