@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | { |
| 45 | 45 | //workaround for weird mgd API behavior where setting falsy (i.e. deleting) a nonexistent parameter |
| 46 | 46 | //returns an error |
| 47 | - if ( !$this->value |
|
| 47 | + if (!$this->value |
|
| 48 | 48 | && $this->load() === null) { |
| 49 | 49 | return true; |
| 50 | 50 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | switch ($this->config['type_config']['multiple_storagemode']) { |
| 64 | 64 | case 'serialized': |
| 65 | 65 | case 'array': |
| 66 | - if ( !is_array($source) |
|
| 66 | + if (!is_array($source) |
|
| 67 | 67 | && empty($source)) { |
| 68 | 68 | $source = array(); |
| 69 | 69 | } |
@@ -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, |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | |
| 62 | 62 | return helper::resolve_options($widget_defaults, $value); |
| 63 | 63 | }); |
| 64 | - $resolver->setNormalizer('type_config', function (Options $options, $value) { |
|
| 64 | + $resolver->setNormalizer('type_config', function(Options $options, $value) { |
|
| 65 | 65 | $type_defaults = array( |
| 66 | 66 | 'options' => array(), |
| 67 | 67 | 'allow_other' => false, |
@@ -144,15 +144,15 @@ discard block |
||
| 144 | 144 | 'validation' => array() |
| 145 | 145 | )); |
| 146 | 146 | |
| 147 | - $normalize_widget = function (Options $options, $value) { |
|
| 148 | - if ( $value == 'images' |
|
| 147 | + $normalize_widget = function(Options $options, $value) { |
|
| 148 | + if ($value == 'images' |
|
| 149 | 149 | || $value == 'downloads') { |
| 150 | 150 | return 'subform'; |
| 151 | 151 | } |
| 152 | 152 | return $value; |
| 153 | 153 | }; |
| 154 | 154 | |
| 155 | - $normalize_storage = function (Options $options, $value) use ($name) { |
|
| 155 | + $normalize_storage = function(Options $options, $value) use ($name) { |
|
| 156 | 156 | $default = array( |
| 157 | 157 | 'location' => 'parameter', |
| 158 | 158 | 'domain' => 'midcom.helper.datamanager2', |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | return $value; |
| 192 | 192 | }; |
| 193 | 193 | |
| 194 | - $normalize_validation = function (Options $options, $config) { |
|
| 194 | + $normalize_validation = function(Options $options, $config) { |
|
| 195 | 195 | $validation = array(); |
| 196 | 196 | if (array_key_exists('validation', (array) $config)) { |
| 197 | 197 | $validation = (array) $config['validation']; |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | $rule = array('type' => $rule); |
| 203 | 203 | } elseif (!array_key_exists('type', $rule)) { |
| 204 | 204 | throw new midcom_error("Missing validation rule type for rule {$key} on field {$config['name']}, this is a required option."); |
| 205 | - } elseif ( $rule['type'] == 'compare' |
|
| 205 | + } elseif ($rule['type'] == 'compare' |
|
| 206 | 206 | && !array_key_exists('compare_with', $rule)) { |
| 207 | 207 | throw new midcom_error("Missing compare_with option for compare type rule {$key} on field {$config['name']}, this is a required option."); |
| 208 | 208 | } |
@@ -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) { |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | $string .= '>'; |
| 234 | 234 | if (null !== $data['empty_value']) { |
| 235 | 235 | $string .= '<option value=""'; |
| 236 | - if ( $data['required'] |
|
| 236 | + if ($data['required'] |
|
| 237 | 237 | && empty($data['value']) |
| 238 | 238 | && "0" !== $data['value']) { |
| 239 | 239 | $string .= ' selected="selected"'; |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | if (!empty($data['form']->vars['type'])) { |
| 256 | 256 | $obj = $data['form']; |
| 257 | 257 | $obj = $data['form']->vars['type']->search_for_object($obj); |
| 258 | - $new_label = $data['form']->vars['type']->render_choices($data['form']->vars['type_conf'],$obj); |
|
| 258 | + $new_label = $data['form']->vars['type']->render_choices($data['form']->vars['type_conf'], $obj); |
|
| 259 | 259 | $view->children[2]->vars['label'] = $new_label; |
| 260 | 260 | } |
| 261 | 261 | return $this->choice_widget_expanded($view, $data); |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | $string .= $this->renderer->widget($view['date']); |
| 310 | 310 | |
| 311 | 311 | if (isset($view['time'])) { |
| 312 | - $string .= ' '. $this->renderer->widget($view['time']); |
|
| 312 | + $string .= ' ' . $this->renderer->widget($view['time']); |
|
| 313 | 313 | } |
| 314 | 314 | $string .= $data['jsinit']; |
| 315 | 315 | return $string . '</fieldset>'; |
@@ -323,7 +323,7 @@ discard block |
||
| 323 | 323 | if (!empty($data['value'])) { |
| 324 | 324 | $string .= '<a href="' . $view->vars['value']['url'] . '" target="_new"><img src="' . $view->vars['value']['url'] . '" class="preview-image">'; |
| 325 | 325 | |
| 326 | - if ( $data['value']['size_x'] |
|
| 326 | + if ($data['value']['size_x'] |
|
| 327 | 327 | && $data['value']['size_y']) { |
| 328 | 328 | $size = "{$data['value']['size_x']}×{$data['value']['size_y']}"; |
| 329 | 329 | } else { |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | if (!empty($values)) { |
| 363 | 363 | $string .= '<ul>'; |
| 364 | 364 | foreach ($values as $identifier => $info) { |
| 365 | - if ( $info['size_x'] |
|
| 365 | + if ($info['size_x'] |
|
| 366 | 366 | && $info['size_y']) { |
| 367 | 367 | $size = "{$info['size_x']}x{$info['size_y']}"; |
| 368 | 368 | } else { |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | $string .= '<label class="midcom_datamanager_photo_lable">' . $this->renderer->humanize('delete photo') . ' ' . $this->renderer->widget($data['form']['delete']) . '</label>'; |
| 381 | 381 | $string .= '</td></tr></table></div>'; |
| 382 | 382 | |
| 383 | - return $string . $this->jsinit('init_photo_widget("' . $view->vars['id'] .'");'); |
|
| 383 | + return $string . $this->jsinit('init_photo_widget("' . $view->vars['id'] . '");'); |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | public function subform_widget(FormView $view, array $data) |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | public function configureOptions(OptionsResolver $resolver) |
| 44 | 44 | { |
| 45 | - $map_privilege = function (Options $options) { |
|
| 45 | + $map_privilege = function(Options $options) { |
|
| 46 | 46 | $return_options = $this->defaultChoices; |
| 47 | 47 | return $return_options; |
| 48 | 48 | }; |