@@ -76,7 +76,7 @@ |
||
76 | 76 | null, |
77 | 77 | 'pagerfanta', |
78 | 78 | ]) |
79 | - ->setNormalizer('actions', function (Options $options, $actions) { |
|
79 | + ->setNormalizer('actions', function(Options $options, $actions) { |
|
80 | 80 | $normalizedActions = []; |
81 | 81 | $addBatchAction = false; |
82 | 82 |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | 'vertical', |
54 | 54 | null, |
55 | 55 | ]) |
56 | - ->setNormalizer('position', function (Options $options, $value) { |
|
56 | + ->setNormalizer('position', function(Options $options, $value) { |
|
57 | 57 | if ('top' === $this->menuName && null === $value) { |
58 | 58 | $value = 'horizontal'; |
59 | 59 | } |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | return $value; |
66 | 66 | }) |
67 | - ->setNormalizer('template', function (Options $options, $value) { |
|
67 | + ->setNormalizer('template', function(Options $options, $value) { |
|
68 | 68 | // Define bootstrap navbar component template |
69 | 69 | if ('horizontal' === $options->offsetGet('position')) { |
70 | 70 | $value = '@LAGAdmin/Menu/menu.horizontal.html.twig'; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | return $value; |
79 | 79 | }) |
80 | - ->setNormalizer('attr', function (Options $options, $value) { |
|
80 | + ->setNormalizer('attr', function(Options $options, $value) { |
|
81 | 81 | $position = $options->offsetGet('position'); |
82 | 82 | |
83 | 83 | if (!key_exists('class', $value)) { |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | |
101 | 101 | return $value; |
102 | 102 | }) |
103 | - ->setNormalizer('item_css_class', function (Options $options, $value) { |
|
103 | + ->setNormalizer('item_css_class', function(Options $options, $value) { |
|
104 | 104 | $position = $options->offsetGet('position'); |
105 | 105 | |
106 | 106 | if (!$value) { |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | |
118 | 118 | return trim($value); |
119 | 119 | }) |
120 | - ->setNormalizer('brand', function (Options $options, $value) { |
|
120 | + ->setNormalizer('brand', function(Options $options, $value) { |
|
121 | 121 | if (null === $value && 'horizontal' === $options->offsetGet('position')) { |
122 | 122 | $value = $this->applicationName; |
123 | 123 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | ->setAllowedTypes('routing_name_pattern', 'string') |
87 | 87 | ->setAllowedTypes('routing_url_pattern', 'string') |
88 | 88 | ->setAllowedTypes('page_parameter', 'string') |
89 | - ->setNormalizer('routing_name_pattern', function (Options $options, $value) { |
|
89 | + ->setNormalizer('routing_name_pattern', function(Options $options, $value) { |
|
90 | 90 | if (false === strstr($value, '{admin}')) { |
91 | 91 | throw new InvalidOptionsException( |
92 | 92 | 'Admin routing configuration pattern name should contains the {admin} placeholder' |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | |
101 | 101 | return $value; |
102 | 102 | }) |
103 | - ->setNormalizer('routing_url_pattern', function (Options $options, $value) { |
|
103 | + ->setNormalizer('routing_url_pattern', function(Options $options, $value) { |
|
104 | 104 | if (false === strstr($value, '{admin}')) { |
105 | 105 | throw new InvalidOptionsException('Admin routing configuration url pattern should contains {admin} placeholder'); |
106 | 106 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | 'pattern' => 'lag.admin.{key}', |
127 | 127 | ]); |
128 | 128 | $resolver->setAllowedTypes('translation', 'array'); |
129 | - $resolver->setNormalizer('translation', function (Options $options, $value) { |
|
129 | + $resolver->setNormalizer('translation', function(Options $options, $value) { |
|
130 | 130 | if (!array_key_exists('enabled', $value)) { |
131 | 131 | throw new InvalidOptionsException('Admin translation enabled parameter should be defined'); |
132 | 132 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | $resolver->setDefault('fields_mapping', $defaultMapping); |
170 | 170 | $resolver->setAllowedTypes('fields_mapping', 'array'); |
171 | - $resolver->setNormalizer('fields_mapping', function (Options $options, $value) use ($defaultMapping) { |
|
171 | + $resolver->setNormalizer('fields_mapping', function(Options $options, $value) use ($defaultMapping) { |
|
172 | 172 | // Merge with default mapping to allow override |
173 | 173 | $value = array_merge($defaultMapping, $value); |
174 | 174 | |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | |
183 | 183 | $resolver->setDefault('fields_template_mapping', $defaultMapping); |
184 | 184 | $resolver->setAllowedTypes('fields_template_mapping', 'array'); |
185 | - $resolver->setNormalizer('fields_template_mapping', function (Options $options, $value) use ($defaultMapping) { |
|
185 | + $resolver->setNormalizer('fields_template_mapping', function(Options $options, $value) use ($defaultMapping) { |
|
186 | 186 | // Merge with default mapping to allow override |
187 | 187 | $value = array_merge($defaultMapping, $value); |
188 | 188 |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | if ('array' === $type) { |
121 | 121 | $builder |
122 | 122 | ->get($field) |
123 | - ->addModelTransformer(new CallbackTransformer(function (?array $value = null) { |
|
123 | + ->addModelTransformer(new CallbackTransformer(function(?array $value = null) { |
|
124 | 124 | if (null === $value) { |
125 | 125 | $value = []; |
126 | 126 | } |
127 | 127 | |
128 | 128 | return Yaml::dump($value); |
129 | - }, function ($value) { |
|
129 | + }, function($value) { |
|
130 | 130 | if (null === $value) { |
131 | 131 | return []; |
132 | 132 | } |
@@ -139,13 +139,13 @@ discard block |
||
139 | 139 | if ('simple_array' === $type) { |
140 | 140 | $builder |
141 | 141 | ->get($field) |
142 | - ->addModelTransformer(new CallbackTransformer(function (?array $value = null) { |
|
142 | + ->addModelTransformer(new CallbackTransformer(function(?array $value = null) { |
|
143 | 143 | if (null === $value) { |
144 | 144 | $value = []; |
145 | 145 | } |
146 | 146 | |
147 | 147 | return implode(',', $value); |
148 | - }, function ($value) { |
|
148 | + }, function($value) { |
|
149 | 149 | if (null === $value) { |
150 | 150 | return []; |
151 | 151 | } |
@@ -46,7 +46,7 @@ |
||
46 | 46 | public function testResolveOptionsWithMissingAction() |
47 | 47 | { |
48 | 48 | $adminConfiguration = $this->createAdminConfigurationMock([ |
49 | - ['actions', [],], |
|
49 | + ['actions', [], ], |
|
50 | 50 | ], 2); |
51 | 51 | |
52 | 52 | $configuration = new ActionConfiguration('my_action', 'my_admin', $adminConfiguration); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | ->setDefault('items', []) |
57 | 57 | ->setDefault('icon', null) |
58 | 58 | ->setDefault('link_css_class', 'nav-link') |
59 | - ->setNormalizer('admin', function (Options $options, $adminName) { |
|
59 | + ->setNormalizer('admin', function(Options $options, $adminName) { |
|
60 | 60 | // user has to defined either an admin name and an action name, or a route name with optional |
61 | 61 | // parameters, or an url |
62 | 62 | if (null === $adminName |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | return $adminName; |
72 | 72 | }) |
73 | 73 | // if an admin name is set, an action name can provided. This action will be the menu link |
74 | - ->setNormalizer('action', function (Options $options, $action) { |
|
74 | + ->setNormalizer('action', function(Options $options, $action) { |
|
75 | 75 | // if an action name is provided, an admin name should be defined too |
76 | 76 | if (null !== $action && null === $options->offsetGet('admin')) { |
77 | 77 | throw new InvalidOptionsException( |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | return $action; |
88 | 88 | }) |
89 | 89 | ->setAllowedTypes('parameters', 'array') |
90 | - ->setNormalizer('attr', function (Options $options, $attr) { |
|
90 | + ->setNormalizer('attr', function(Options $options, $attr) { |
|
91 | 91 | if (!is_array($attr)) { |
92 | 92 | $attr = []; |
93 | 93 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | |
103 | 103 | return $attr; |
104 | 104 | }) |
105 | - ->setNormalizer('link_attr', function (Options $options, $value) { |
|
105 | + ->setNormalizer('link_attr', function(Options $options, $value) { |
|
106 | 106 | if (!is_array($value)) { |
107 | 107 | $value = []; |
108 | 108 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | |
114 | 114 | return $value; |
115 | 115 | }) |
116 | - ->setNormalizer('items', function (Options $options, $items) { |
|
116 | + ->setNormalizer('items', function(Options $options, $items) { |
|
117 | 117 | if (!is_array($items)) { |
118 | 118 | $items = []; |
119 | 119 | } |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | |
131 | 131 | return $resolvedItems; |
132 | 132 | }) |
133 | - ->setNormalizer('text', function (Options $options, $text) { |
|
133 | + ->setNormalizer('text', function(Options $options, $text) { |
|
134 | 134 | if ($text) { |
135 | 135 | return $text; |
136 | 136 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | '_self', |
57 | 57 | '_blank', |
58 | 58 | ]) |
59 | - ->setNormalizer('route', function (Options $options, $value) use ($actionConfiguration) { |
|
59 | + ->setNormalizer('route', function(Options $options, $value) use ($actionConfiguration) { |
|
60 | 60 | // route or url should be defined |
61 | 61 | if (!$value && !$options->offsetGet('url') && !$options->offsetGet('admin')) { |
62 | 62 | throw new InvalidOptionsException( |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | return $value; |
76 | 76 | }) |
77 | - ->setNormalizer('admin', function (Options $options, $value) { |
|
77 | + ->setNormalizer('admin', function(Options $options, $value) { |
|
78 | 78 | // if a Admin is defined, an Action should be defined too |
79 | 79 | if ($value && !$options->offsetGet('action')) { |
80 | 80 | throw new InvalidOptionsException( |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | return $value; |
86 | 86 | }) |
87 | - ->setNormalizer('parameters', function (Options $options, $values) { |
|
87 | + ->setNormalizer('parameters', function(Options $options, $values) { |
|
88 | 88 | $cleanedValues = []; |
89 | 89 | |
90 | 90 | foreach ($values as $name => $method) { |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | |
97 | 97 | return $cleanedValues; |
98 | 98 | }) |
99 | - ->setNormalizer('text', function (Options $options, $value) use ($actionConfiguration) { |
|
99 | + ->setNormalizer('text', function(Options $options, $value) use ($actionConfiguration) { |
|
100 | 100 | if ($value) { |
101 | 101 | return $value; |
102 | 102 | } |
@@ -23,7 +23,7 @@ |
||
23 | 23 | |
24 | 24 | $resolver |
25 | 25 | ->setDefault('class', '') |
26 | - ->setNormalizer('class', function (Options $options, $value) { |
|
26 | + ->setNormalizer('class', function(Options $options, $value) { |
|
27 | 27 | if ($value) { |
28 | 28 | return $value; |
29 | 29 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | 'template' => '@LAGAdmin/Field/actionCollection.html.twig', |
32 | 32 | 'actions' => [], |
33 | 33 | ]) |
34 | - ->setNormalizer('actions', function (Options $options, $value) use ($actionConfiguration) { |
|
34 | + ->setNormalizer('actions', function(Options $options, $value) use ($actionConfiguration) { |
|
35 | 35 | if (!is_array($value) || 0 === count($value)) { |
36 | 36 | $value = [ |
37 | 37 | 'edit' => [], |