@@ -96,8 +96,7 @@ |
||
96 | 96 | $triggering_element = $form_state->getTriggeringElement(); |
97 | 97 | if ($triggering_element['#name'] == 'prev_page') { |
98 | 98 | $page--; |
99 | - } |
|
100 | - elseif ($triggering_element['#name'] == 'next_page') { |
|
99 | + } elseif ($triggering_element['#name'] == 'next_page') { |
|
101 | 100 | $page++; |
102 | 101 | } |
103 | 102 |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | * {@inheritdoc} |
100 | 100 | */ |
101 | 101 | public function getForm(array &$original_form, FormStateInterface $form_state, array $additional_widget_parameters) { |
102 | - if (empty($this->configuration['entity_type']) || empty($this->configuration['bundle']) || empty($this->configuration['form_mode'])) { |
|
102 | + if (empty($this->configuration['entity_type']) || empty($this->configuration['bundle']) || empty($this->configuration['form_mode'])) { |
|
103 | 103 | return ['#markup' => $this->t('The settings for this widget (Entity type, Bundle or Form mode) are not configured correctly.')]; |
104 | 104 | } |
105 | 105 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | // Pretend to be IEFs submit button. |
109 | 109 | $form['#submit'] = [['Drupal\inline_entity_form\ElementSubmit', 'trigger']]; |
110 | - $form['actions']['submit']['#ief_submit_trigger'] = TRUE; |
|
110 | + $form['actions']['submit']['#ief_submit_trigger'] = TRUE; |
|
111 | 111 | $form['actions']['submit']['#ief_submit_trigger_all'] = TRUE; |
112 | 112 | |
113 | 113 | $form['inline_entity_form'] = [ |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | $entities = $this->prepareEntities($form, $form_state); |
137 | 137 | array_walk( |
138 | 138 | $entities, |
139 | - function (EntityInterface $entity) { |
|
139 | + function(EntityInterface $entity) { |
|
140 | 140 | $entity->save(); |
141 | 141 | } |
142 | 142 | ); |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $definitions = $this->entityTypeManager->getDefinitions(); |
159 | 159 | $entity_types = array_combine( |
160 | 160 | array_keys($definitions), |
161 | - array_map(function (EntityTypeInterface $item) { |
|
161 | + array_map(function(EntityTypeInterface $item) { |
|
162 | 162 | return $item->getLabel(); |
163 | 163 | }, $definitions) |
164 | 164 | ); |
@@ -176,7 +176,7 @@ discard block |
||
176 | 176 | $bundles = []; |
177 | 177 | if ($entity_type) { |
178 | 178 | $definitions = $this->entityTypeBundleInfo->getBundleInfo($entity_type); |
179 | - $bundles = array_map(function ($item) { |
|
179 | + $bundles = array_map(function($item) { |
|
180 | 180 | return $item['label']; |
181 | 181 | }, $definitions); |
182 | 182 | } |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | '#options' => $bundles, |
190 | 190 | '#default_value' => $bundle, |
191 | 191 | ], |
192 | - '#attributes' => ['id' => 'bundle-wrapper-' . $this->uuid()], |
|
192 | + '#attributes' => ['id' => 'bundle-wrapper-'.$this->uuid()], |
|
193 | 193 | ]; |
194 | 194 | |
195 | 195 | $form['form_mode'] = [ |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | '#default_value' => $form_mode, |
201 | 201 | '#options' => $this->entityDisplayRepository->getFormModeOptions($entity_type), |
202 | 202 | ], |
203 | - '#attributes' => ['id' => 'form-mode-wrapper-' . $this->uuid()], |
|
203 | + '#attributes' => ['id' => 'form-mode-wrapper-'.$this->uuid()], |
|
204 | 204 | ]; |
205 | 205 | |
206 | 206 | return $form; |
@@ -225,8 +225,8 @@ discard block |
||
225 | 225 | */ |
226 | 226 | public function updateFormElements($form, FormStateInterface $form_state) { |
227 | 227 | $response = new AjaxResponse(); |
228 | - $response->addCommand(new ReplaceCommand('#bundle-wrapper-' . $this->uuid(), $this->updateBundle($form, $form_state))); |
|
229 | - $response->addCommand(new ReplaceCommand('#form-mode-wrapper-' . $this->uuid(), $this->updateFormMode($form, $form_state))); |
|
228 | + $response->addCommand(new ReplaceCommand('#bundle-wrapper-'.$this->uuid(), $this->updateBundle($form, $form_state))); |
|
229 | + $response->addCommand(new ReplaceCommand('#form-mode-wrapper-'.$this->uuid(), $this->updateFormMode($form, $form_state))); |
|
230 | 230 | return $response; |
231 | 231 | } |
232 | 232 |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | |
209 | 209 | $delta = 0; |
210 | 210 | |
211 | - $order_class = $field_machine_name . '-delta-order'; |
|
211 | + $order_class = $field_machine_name.'-delta-order'; |
|
212 | 212 | |
213 | 213 | $current = [ |
214 | 214 | '#type' => 'table', |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $current[$entity_id] = [ |
276 | 276 | '#attributes' => [ |
277 | 277 | 'class' => ['draggable'], |
278 | - 'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity_id, |
|
278 | + 'data-entity-id' => $entity->getEntityTypeId().':'.$entity_id, |
|
279 | 279 | 'data-row-id' => $delta, |
280 | 280 | ], |
281 | 281 | ]; |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | 'options' => ['query' => ['details_id' => $details_id]], |
348 | 348 | ], |
349 | 349 | '#attributes' => [ |
350 | - 'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity->id(), |
|
350 | + 'data-entity-id' => $entity->getEntityTypeId().':'.$entity->id(), |
|
351 | 351 | 'data-row-id' => $delta, |
352 | 352 | ], |
353 | 353 | '#access' => $can_edit, |
@@ -360,10 +360,10 @@ discard block |
||
360 | 360 | 'wrapper' => $details_id, |
361 | 361 | ], |
362 | 362 | '#submit' => [[get_class($this), 'removeItemSubmit']], |
363 | - '#name' => $field_machine_name . '_remove_' . $entity_id . '_' . md5(json_encode($field_parents)), |
|
363 | + '#name' => $field_machine_name.'_remove_'.$entity_id.'_'.md5(json_encode($field_parents)), |
|
364 | 364 | '#limit_validation_errors' => [array_merge($field_parents, [$field_machine_name, 'target_id'])], |
365 | 365 | '#attributes' => [ |
366 | - 'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity->id(), |
|
366 | + 'data-entity-id' => $entity->getEntityTypeId().':'.$entity->id(), |
|
367 | 367 | 'data-row-id' => $delta, |
368 | 368 | ], |
369 | 369 | '#access' => (bool) $widget_settings['field_widget_remove'], |
@@ -421,7 +421,7 @@ discard block |
||
421 | 421 | } |
422 | 422 | |
423 | 423 | // Return ourself as the structure doesn't match the default. |
424 | - usort($return, function ($a, $b) { |
|
424 | + usort($return, function($a, $b) { |
|
425 | 425 | return SortArray::sortByKeyInt($a, $b, '_weight'); |
426 | 426 | }); |
427 | 427 | |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | // Add validators based on our current settings. |
485 | 485 | $data['validators']['file'] = ['validators' => $this->getFileValidators()]; |
486 | 486 | // Provide context for widgets to enhance their configuration. |
487 | - $data['widget_context']['upload_location'] = $settings['uri_scheme'] . '://' . $settings['file_directory']; |
|
487 | + $data['widget_context']['upload_location'] = $settings['uri_scheme'].'://'.$settings['file_directory']; |
|
488 | 488 | $data['widget_context']['upload_validators'] = $this->getFileValidators(TRUE); |
489 | 489 | return $data; |
490 | 490 | } |
@@ -176,8 +176,7 @@ discard block |
||
176 | 176 | // their styles in code. |
177 | 177 | elseif ($this->fieldDefinition->getType() == 'image' && $image_style = ImageStyle::load($image_style_setting)) { |
178 | 178 | $preview_image_style = $this->t('Preview image style: @style', ['@style' => $image_style->label()]); |
179 | - } |
|
180 | - else { |
|
179 | + } else { |
|
181 | 180 | $preview_image_style = $this->t('No preview image'); |
182 | 181 | } |
183 | 182 | array_unshift($summary, $preview_image_style); |
@@ -261,8 +260,7 @@ discard block |
||
261 | 260 | if ($field_type == 'file') { |
262 | 261 | $description = $item->description; |
263 | 262 | $display_field = $item->display; |
264 | - } |
|
265 | - elseif ($field_type == 'image') { |
|
263 | + } elseif ($field_type == 'image') { |
|
266 | 264 | $alt = $item->alt; |
267 | 265 | $title = $item->title; |
268 | 266 | $width = $item->width; |
@@ -467,8 +465,7 @@ discard block |
||
467 | 465 | if (!empty($settings['max_resolution']) || !empty($settings['min_resolution'])) { |
468 | 466 | $validators['entity_browser_file_validate_image_resolution'] = [$settings['max_resolution'], $settings['min_resolution']]; |
469 | 467 | } |
470 | - } |
|
471 | - elseif (!empty($settings['file_extensions'])) { |
|
468 | + } elseif (!empty($settings['file_extensions'])) { |
|
472 | 469 | $validators['file_validate_extensions'] = [$settings['file_extensions']]; |
473 | 470 | } |
474 | 471 |