@@ -99,7 +99,7 @@ |
||
99 | 99 | $qb = midcom::get()->dbfactory->new_query_builder($this->config['type_config']['mapping_class_name']); |
100 | 100 | $qb->add_constraint($this->config['type_config']['master_fieldname'], '=', $this->get_master_foreign_key()); |
101 | 101 | |
102 | - if ( $this->config['type_config']['sortable'] |
|
102 | + if ($this->config['type_config']['sortable'] |
|
103 | 103 | && preg_match('/^(ASC|DESC)/i', $this->config['type_config']['sortable_sort_order'], $regs)) { |
104 | 104 | $order = strtoupper($regs[1]); |
105 | 105 | $qb->add_order('metadata.score', $order); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | */ |
125 | 125 | public function set_storage(midcom_core_dbaobject $storage = null, $schema = null) |
126 | 126 | { |
127 | - if ( $schema === null |
|
127 | + if ($schema === null |
|
128 | 128 | && !empty($storage->id)) { |
129 | 129 | $schema = $storage->get_parameter('midcom.helper.datamanager2', 'schema_name'); |
130 | 130 | } |
@@ -188,12 +188,12 @@ discard block |
||
188 | 188 | // Replace the dots in the component name with underscores |
189 | 189 | $name = midcom::get()->componentloader->path_to_prefix($name); |
190 | 190 | } |
191 | - if (! $name) { |
|
191 | + if (!$name) { |
|
192 | 192 | // Fallback for componentless operation |
193 | 193 | $name = 'midcom_helper_datamanager2'; |
194 | 194 | } |
195 | 195 | |
196 | - if ( $this->form === null |
|
196 | + if ($this->form === null |
|
197 | 197 | || $this->form->getName() != $name) { |
198 | 198 | $this->get_storage(); |
199 | 199 | $builder = self::get_factory()->createNamedBuilder($name, compat::get_type_name('form'), $this->storage); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | { |
37 | 37 | $string = ''; |
38 | 38 | foreach ($view as $child) { |
39 | - if ( array_key_exists('start_fieldset', $child->vars) |
|
39 | + if (array_key_exists('start_fieldset', $child->vars) |
|
40 | 40 | && $child->vars['start_fieldset'] !== null) { |
41 | 41 | $string .= '<fieldset class="fieldset">'; |
42 | 42 | if (!empty($child->vars['start_fieldset']['title'])) { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | } |
45 | 45 | } |
46 | 46 | $string .= $this->renderer->row($child); |
47 | - if ( array_key_exists('end_fieldset', $child->vars) |
|
47 | + if (array_key_exists('end_fieldset', $child->vars) |
|
48 | 48 | && $child->vars['end_fieldset'] !== null) { |
49 | 49 | $end_fieldsets = max(1, (int) $child->vars['end_fieldset']); |
50 | 50 | for ($i = 0; $i < $end_fieldsets; $i++) { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | public function form_end(FormView $view, array $data) |
59 | 59 | { |
60 | 60 | $string = ''; |
61 | - if ( !isset($data['render_rest']) |
|
61 | + if (!isset($data['render_rest']) |
|
62 | 62 | || $data['render_rest']) { |
63 | 63 | $string .= $this->renderer->rest($view); |
64 | 64 | } |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | public function form_widget_simple(FormView $view, array $data) |
144 | 144 | { |
145 | 145 | $type = isset($data['type']) ? $data['type'] : 'text'; |
146 | - if ( $type == 'text' |
|
146 | + if ($type == 'text' |
|
147 | 147 | || $type == 'password' |
148 | 148 | || $type == 'email') { |
149 | 149 | $view->vars['attr']['class'] = 'shorttext'; |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | |
152 | 152 | $string = '<input type="' . $type . '"'; |
153 | 153 | $string .= $this->renderer->block($view, 'widget_attributes'); |
154 | - if ( !empty($data['value']) |
|
154 | + if (!empty($data['value']) |
|
155 | 155 | || is_numeric($data['value'])) { |
156 | 156 | $string .= ' value="' . $this->escape($data['value']) . '"'; |
157 | 157 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $jsinit .= "midcom_helper_datamanager2_autocomplete.create_dm2_widget('{$element_id}_search_input', {$data['min_chars']});\n"; |
185 | 185 | |
186 | 186 | $string = '<fieldset ' . $this->renderer->block($view, 'widget_container_attributes') . '>'; |
187 | - $string .= $this->renderer->widget($view['selection']); |
|
187 | + $string .= $this->renderer->widget($view['selection']); |
|
188 | 188 | $string .= ' ' . $this->renderer->widget($view['search_input']); |
189 | 189 | $string .= '</fieldset>'; |
190 | 190 | return $string . $this->jsinit($jsinit); |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | public function choice_widget_collapsed(FormView $view, array $data) |
220 | 220 | { |
221 | 221 | $string = '<select'; |
222 | - if ( $data['required'] |
|
222 | + if ($data['required'] |
|
223 | 223 | && null === $data['empty_value'] |
224 | 224 | && $data['empty_value_in_choices'] === false |
225 | 225 | && $data['multiple'] === false) { |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | $string .= '>'; |
233 | 233 | if (null !== $data['empty_value']) { |
234 | 234 | $string .= '<option value=""'; |
235 | - if ( $data['required'] |
|
235 | + if ($data['required'] |
|
236 | 236 | && empty($data['value']) |
237 | 237 | && "0" !== $data['value']) { |
238 | 238 | $string .= ' selected="selected"'; |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | $string .= $this->renderer->widget($view['date']); |
304 | 304 | |
305 | 305 | if (isset($view['time'])) { |
306 | - $string .= ' '. $this->renderer->widget($view['time']); |
|
306 | + $string .= ' ' . $this->renderer->widget($view['time']); |
|
307 | 307 | } |
308 | 308 | $string .= $data['jsinit']; |
309 | 309 | return $string . '</fieldset>'; |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | if (!empty($data['value'])) { |
318 | 318 | $string .= '<a href="' . $view->vars['value']['url'] . '" target="_new"><img src="' . $view->vars['value']['url'] . '" class="preview-image">'; |
319 | 319 | |
320 | - if ( $data['value']['size_x'] |
|
320 | + if ($data['value']['size_x'] |
|
321 | 321 | && $data['value']['size_y']) { |
322 | 322 | $size = "{$data['value']['size_x']}×{$data['value']['size_y']}"; |
323 | 323 | } else { |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | if (!empty($values)) { |
357 | 357 | $string .= '<ul>'; |
358 | 358 | foreach ($values as $identifier => $info) { |
359 | - if ( $info['size_x'] |
|
359 | + if ($info['size_x'] |
|
360 | 360 | && $info['size_y']) { |
361 | 361 | $size = "{$info['size_x']}x{$info['size_y']}"; |
362 | 362 | } else { |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | $string .= '<label class="midcom_datamanager_photo_lable">' . $this->renderer->humanize('delete photo') . ' ' . $this->renderer->widget($data['form']['delete']) . '</label>'; |
375 | 375 | $string .= '</td></tr></table></div>'; |
376 | 376 | |
377 | - return $string . $this->jsinit('init_photo_widget("' . $view->vars['id'] .'");'); |
|
377 | + return $string . $this->jsinit('init_photo_widget("' . $view->vars['id'] . '");'); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | public function subform_widget(FormView $view, array $data) |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function configureOptions(OptionsResolver $resolver) |
31 | 31 | { |
32 | - $resolver->setNormalizer('widget_config', function (Options $options, $value) { |
|
32 | + $resolver->setNormalizer('widget_config', function(Options $options, $value) { |
|
33 | 33 | $widget_defaults = array( |
34 | 34 | 'creation_mode_enabled' => false, |
35 | 35 | 'class' => null, |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | ); |
50 | 50 | return helper::resolve_options($widget_defaults, $value); |
51 | 51 | }); |
52 | - $resolver->setNormalizer('type_config', function (Options $options, $value) { |
|
52 | + $resolver->setNormalizer('type_config', function(Options $options, $value) { |
|
53 | 53 | $type_defaults = array( |
54 | 54 | 'options' => array(), |
55 | 55 | 'allow_other' => false, |
@@ -106,7 +106,8 @@ |
||
106 | 106 | try { |
107 | 107 | $object = new $options['widget_config']['class']($identifier); |
108 | 108 | $preset[$identifier] = \midcom_helper_datamanager2_widget_autocomplete::create_item_label($object, $options['widget_config']['result_headers'], $options['widget_config']['get_label_for']); |
109 | - } catch (midcom_error $e) { |
|
109 | + } |
|
110 | + catch (midcom_error $e) { |
|
110 | 111 | $e->log(); |
111 | 112 | } |
112 | 113 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | parent::configureOptions($resolver); |
45 | 45 | |
46 | - $map_attr = function (Options $options, $value) { |
|
46 | + $map_attr = function(Options $options, $value) { |
|
47 | 47 | if ($value === null) { |
48 | 48 | $value = array(); |
49 | 49 | } |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | return $value; |
54 | 54 | }; |
55 | 55 | |
56 | - $get_config = function (Options $options, $value) { |
|
56 | + $get_config = function(Options $options, $value) { |
|
57 | 57 | return \midcom_baseclasses_components_configuration::get('midcom.helper.datamanager2', 'config'); |
58 | 58 | }; |
59 | 59 | |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | 'config' => $get_config |
63 | 63 | )); |
64 | 64 | |
65 | - $resolver->setNormalizer('widget_config', function (Options $options, $value) { |
|
65 | + $resolver->setNormalizer('widget_config', function(Options $options, $value) { |
|
66 | 66 | $widget_defaults = array( |
67 | 67 | 'enabled' => true, |
68 | 68 | 'language' => 'php', |
69 | 69 | ); |
70 | 70 | return helper::resolve_options($widget_defaults, $value); |
71 | 71 | }); |
72 | - $resolver->setNormalizer('type_config', function (Options $options, $value) { |
|
72 | + $resolver->setNormalizer('type_config', function(Options $options, $value) { |
|
73 | 73 | $type_defaults = array( |
74 | 74 | 'modes' => array('xml', 'javascript', 'css', 'clike', 'php'), |
75 | 75 | ); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $resolver->setDefaults(array( |
49 | 49 | 'error_bubbling' => false |
50 | 50 | )); |
51 | - $resolver->setNormalizer('widget_config', function (Options $options, $value) { |
|
51 | + $resolver->setNormalizer('widget_config', function(Options $options, $value) { |
|
52 | 52 | $widget_defaults = array( |
53 | 53 | 'showOn' => 'both', |
54 | 54 | 'format' => '%Y-%m-%d %H:%M', |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | ); |
60 | 60 | return helper::resolve_options($widget_defaults, $value); |
61 | 61 | }); |
62 | - $resolver->setNormalizer('type_config', function (Options $options, $value) { |
|
62 | + $resolver->setNormalizer('type_config', function(Options $options, $value) { |
|
63 | 63 | $type_defaults = array( |
64 | 64 | 'storage_type' => jsdate::ISO, |
65 | 65 | ); |
@@ -24,7 +24,7 @@ |
||
24 | 24 | */ |
25 | 25 | public function configureOptions(OptionsResolver $resolver) |
26 | 26 | { |
27 | - $resolver->setNormalizer('widget_config', function (Options $options, $value) { |
|
27 | + $resolver->setNormalizer('widget_config', function(Options $options, $value) { |
|
28 | 28 | $widget_defaults = array( |
29 | 29 | 'map_action_elements' => false, |
30 | 30 | 'show_title' => true, |
@@ -33,17 +33,17 @@ |
||
33 | 33 | public function configureOptions(OptionsResolver $resolver) |
34 | 34 | { |
35 | 35 | parent::configureOptions($resolver); |
36 | - $map_options = function (Options $options) { |
|
36 | + $map_options = function(Options $options) { |
|
37 | 37 | $return_options = array(); |
38 | 38 | if (isset($options['type_config']['options'])) { |
39 | 39 | foreach ($options['type_config']['options'] as $key => $value) { |
40 | 40 | //symfony expects only strings |
41 | - $return_options[$value] = (string)$key; |
|
41 | + $return_options[$value] = (string) $key; |
|
42 | 42 | } |
43 | 43 | return $return_options; |
44 | 44 | } |
45 | 45 | }; |
46 | - $map_multiple = function (Options $options) { |
|
46 | + $map_multiple = function(Options $options) { |
|
47 | 47 | return !empty($options['type_config']['allow_multiple']); |
48 | 48 | }; |
49 | 49 |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | $resolver->setDefaults(array( |
40 | 40 | 'error_bubbling' => false |
41 | 41 | )); |
42 | - $resolver->setNormalizer('widget_config', function (Options $options, $value) { |
|
42 | + $resolver->setNormalizer('widget_config', function(Options $options, $value) { |
|
43 | 43 | $widget_defaults = array( |
44 | 44 | 'map_action_elements' => false, |
45 | 45 | 'show_title' => false |
46 | 46 | ); |
47 | 47 | return helper::resolve_options($widget_defaults, $value); |
48 | 48 | }); |
49 | - $resolver->setNormalizer('constraints', function (Options $options, $value) { |
|
49 | + $resolver->setNormalizer('constraints', function(Options $options, $value) { |
|
50 | 50 | if ($options['required']) { |
51 | 51 | return array(new constraint()); |
52 | 52 | } |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | $builder->add('delete', compat::get_type_name('checkbox'), array('attr' => array( |
68 | 68 | "class" => "midcom_datamanager_photo_checkbox" |
69 | - ), "required" => false )); |
|
69 | + ), "required" => false)); |
|
70 | 70 | $builder->add('identifier', compat::get_type_name('hidden'), array('data' => 'file')); |
71 | 71 | |
72 | 72 | $head = midcom::get()->head; |