@@ -84,14 +84,14 @@ |
||
84 | 84 | $views = Views::getAllViews(); |
85 | 85 | foreach ($views as $view_id => $view) { |
86 | 86 | foreach ($view->get('display') as $display_id => $display) { |
87 | - $options[$view_id . '.' . $display_id] = $this->t('@view : @display', array('@view' => $view->label(), '@display' => $display['display_title'])); |
|
87 | + $options[$view_id.'.'.$display_id] = $this->t('@view : @display', array('@view' => $view->label(), '@display' => $display['display_title'])); |
|
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | 91 | $form['view'] = [ |
92 | 92 | '#type' => 'select', |
93 | 93 | '#title' => $this->t('View : View display'), |
94 | - '#default_value' => $this->configuration['view'] . '.' . $this->configuration['view_display'], |
|
94 | + '#default_value' => $this->configuration['view'].'.'.$this->configuration['view_display'], |
|
95 | 95 | '#options' => $options, |
96 | 96 | '#required' => TRUE, |
97 | 97 | '#description' => 'View display to use for displaying currently selected items. Do note that to get something usefull out of this display, its first contextual filter should be a filter on the primary identifier field of your entity type (e.g., Node ID, Media ID).', |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | 'entity_browser' => [ |
149 | 149 | 'iframe' => [ |
150 | 150 | $uuid => [ |
151 | - 'src' => Url::fromRoute('entity_browser.' . $this->configuration['entity_browser_id'], [], $data['query_parameters']) |
|
151 | + 'src' => Url::fromRoute('entity_browser.'.$this->configuration['entity_browser_id'], [], $data['query_parameters']) |
|
152 | 152 | ->toString(), |
153 | 153 | 'width' => $this->configuration['width'], |
154 | 154 | 'height' => $this->configuration['height'], |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | public function propagateSelection(FilterResponseEvent $event) { |
183 | 183 | $render = [ |
184 | 184 | 'labels' => [ |
185 | - '#markup' => 'Labels: ' . implode(', ', array_map(function (EntityInterface $item) { |
|
185 | + '#markup' => 'Labels: '.implode(', ', array_map(function(EntityInterface $item) { |
|
186 | 186 | return $item->label(); |
187 | 187 | }, $this->entities)), |
188 | 188 | '#attached' => [ |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | 'drupalSettings' => [ |
191 | 191 | 'entity_browser' => [ |
192 | 192 | 'iframe' => [ |
193 | - 'entities' => array_map(function (EntityInterface $item) { |
|
193 | + 'entities' => array_map(function(EntityInterface $item) { |
|
194 | 194 | return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; |
195 | 195 | }, $this->entities), |
196 | 196 | 'uuid' => $this->request->query->get('uuid'), |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * {@inheritdoc} |
209 | 209 | */ |
210 | 210 | public function path() { |
211 | - return '/entity-browser/iframe/' . $this->configuration['entity_browser_id']; |
|
211 | + return '/entity-browser/iframe/'.$this->configuration['entity_browser_id']; |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * {@inheritdoc} |
97 | 97 | */ |
98 | 98 | public function getForm(array &$original_form, FormStateInterface $form_state, array $aditional_widget_parameters) { |
99 | - if (empty($this->configuration['entity_type']) || empty($this->configuration['bundle']) || empty($this->configuration['form_mode'])) { |
|
99 | + if (empty($this->configuration['entity_type']) || empty($this->configuration['bundle']) || empty($this->configuration['form_mode'])) { |
|
100 | 100 | return ['#markup' => t('The settings for this widget (Entity type, Bundle or Form mode) are not configured correctly.')]; |
101 | 101 | } |
102 | 102 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | $definitions = $this->entityTypeManager->getDefinitions(); |
138 | 138 | $entity_types = array_combine( |
139 | 139 | array_keys($definitions), |
140 | - array_map(function (EntityTypeInterface $item) { |
|
140 | + array_map(function(EntityTypeInterface $item) { |
|
141 | 141 | return $item->getLabel(); |
142 | 142 | }, $definitions) |
143 | 143 | ); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | $bundles = []; |
156 | 156 | if ($entity_type) { |
157 | 157 | $definitions = $this->entityTypeBundleInfo->getBundleInfo($entity_type); |
158 | - $bundles = array_map(function ($item) { |
|
158 | + $bundles = array_map(function($item) { |
|
159 | 159 | return $item['label']; |
160 | 160 | }, $definitions); |
161 | 161 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | '#options' => $bundles, |
169 | 169 | '#default_value' => $bundle, |
170 | 170 | ], |
171 | - '#attributes' => ['id' => 'bundle-wrapper-' . $this->uuid()], |
|
171 | + '#attributes' => ['id' => 'bundle-wrapper-'.$this->uuid()], |
|
172 | 172 | ]; |
173 | 173 | |
174 | 174 | $form['form_mode'] = [ |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | '#default_value' => $form_mode, |
180 | 180 | '#options' => $this->entityDisplayRepository->getFormModeOptions($entity_type), |
181 | 181 | ], |
182 | - '#attributes' => ['id' => 'form-mode-wrapper-' . $this->uuid()], |
|
182 | + '#attributes' => ['id' => 'form-mode-wrapper-'.$this->uuid()], |
|
183 | 183 | ]; |
184 | 184 | |
185 | 185 | return $form; |
@@ -204,8 +204,8 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public function updateFormElements($form, FormStateInterface $form_state) { |
206 | 206 | $response = new AjaxResponse(); |
207 | - $response->addCommand(new ReplaceCommand('#bundle-wrapper-' . $this->uuid(), $this->updateBundle($form, $form_state))); |
|
208 | - $response->addCommand(new ReplaceCommand('#form-mode-wrapper-' . $this->uuid(), $this->updateFormMode($form, $form_state))); |
|
207 | + $response->addCommand(new ReplaceCommand('#bundle-wrapper-'.$this->uuid(), $this->updateBundle($form, $form_state))); |
|
208 | + $response->addCommand(new ReplaceCommand('#form-mode-wrapper-'.$this->uuid(), $this->updateFormMode($form, $form_state))); |
|
209 | 209 | return $response; |
210 | 210 | } |
211 | 211 |
@@ -63,8 +63,8 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | $default_value = implode(' ', array_map( |
66 | - function (EntityInterface $item) { |
|
67 | - return $item->getEntityTypeId() . ':' . $item->id(); |
|
66 | + function(EntityInterface $item) { |
|
67 | + return $item->getEntityTypeId().':'.$item->id(); |
|
68 | 68 | }, |
69 | 69 | $element['#default_value'] |
70 | 70 | )); |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | ['validators' => $validators, 'selected_entities' => $element['#default_value']] |
86 | 86 | ); |
87 | 87 | |
88 | - $hidden_id = Html::getUniqueId($element['#id'] . '-target'); |
|
88 | + $hidden_id = Html::getUniqueId($element['#id'].'-target'); |
|
89 | 89 | $element['entity_ids'] = [ |
90 | 90 | '#type' => 'hidden', |
91 | 91 | '#id' => $hidden_id, |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $element['#attached']['drupalSettings']['entity_browser'] = [ |
98 | 98 | $entity_browser->getDisplay()->getUuid() => [ |
99 | 99 | 'cardinality' => $element['#cardinality'], |
100 | - 'selector' => '#' . $hidden_id, |
|
100 | + 'selector' => '#'.$hidden_id, |
|
101 | 101 | ], |
102 | 102 | ]; |
103 | 103 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | } |
138 | 138 | |
139 | 139 | return array_map( |
140 | - function ($item) { |
|
140 | + function($item) { |
|
141 | 141 | list($entity_type, $entity_id) = explode(':', $item); |
142 | 142 | return \Drupal::entityTypeManager()->getStorage($entity_type)->load($entity_id); |
143 | 143 | }, |
@@ -116,8 +116,7 @@ |
||
116 | 116 | |
117 | 117 | if (!$this->isSelectionCompleted($form_state)) { |
118 | 118 | $form_state->setRebuild(); |
119 | - } |
|
120 | - else { |
|
119 | + } else { |
|
121 | 120 | $entity_browser->getDisplay()->selectionCompleted($this->getSelectedEntities($form_state)); |
122 | 121 | } |
123 | 122 | } |
@@ -51,22 +51,22 @@ |
||
51 | 51 | $this->assertFieldByXPath("//input[@type='hidden' and @id='edit-fancy-entity-browser-target']", '', "Entity browser's hidden element found."); |
52 | 52 | |
53 | 53 | $edit = [ |
54 | - 'fancy_entity_browser[entity_ids]' => $this->nodes[0]->getEntityTypeId() . ':' . $this->nodes[0]->id() . ' ' . $this->nodes[1]->getEntityTypeId() . ':' . $this->nodes[1]->id(), |
|
54 | + 'fancy_entity_browser[entity_ids]' => $this->nodes[0]->getEntityTypeId().':'.$this->nodes[0]->id().' '.$this->nodes[1]->getEntityTypeId().':'.$this->nodes[1]->id(), |
|
55 | 55 | ]; |
56 | 56 | $this->drupalPostForm(NULL, $edit, 'Submit'); |
57 | - $expected = 'Selected entities: ' . $this->nodes[0]->label() . ', ' . $this->nodes[1]->label(); |
|
57 | + $expected = 'Selected entities: '.$this->nodes[0]->label().', '.$this->nodes[1]->label(); |
|
58 | 58 | $this->assertText($expected, 'Selected entities detected.'); |
59 | 59 | |
60 | - $default_entity = $this->nodes[0]->getEntityTypeId() . ':' . $this->nodes[0]->id(); |
|
60 | + $default_entity = $this->nodes[0]->getEntityTypeId().':'.$this->nodes[0]->id(); |
|
61 | 61 | $this->drupalGet('/test-element', ['query' => ['default_entity' => $default_entity]]); |
62 | 62 | $this->assertLink('Select entities', 0, 'Trigger link found.'); |
63 | 63 | $this->assertFieldByXPath("//input[@type='hidden' and @id='edit-fancy-entity-browser-target']", $default_entity, "Entity browser's hidden element found."); |
64 | 64 | |
65 | 65 | $edit = [ |
66 | - 'fancy_entity_browser[entity_ids]' => $this->nodes[1]->getEntityTypeId() . ':' . $this->nodes[1]->id() . ' ' . $this->nodes[0]->getEntityTypeId() . ':' . $this->nodes[0]->id(), |
|
66 | + 'fancy_entity_browser[entity_ids]' => $this->nodes[1]->getEntityTypeId().':'.$this->nodes[1]->id().' '.$this->nodes[0]->getEntityTypeId().':'.$this->nodes[0]->id(), |
|
67 | 67 | ]; |
68 | 68 | $this->drupalPostForm(NULL, $edit, 'Submit'); |
69 | - $expected = 'Selected entities: ' . $this->nodes[1]->label() . ', ' . $this->nodes[0]->label(); |
|
69 | + $expected = 'Selected entities: '.$this->nodes[1]->label().', '.$this->nodes[0]->label(); |
|
70 | 70 | $this->assertText($expected, 'Selected entities detected.'); |
71 | 71 | } |
72 | 72 |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | $delta = 0; |
229 | 229 | |
230 | - $order_class = $field_machine_name . '-delta-order'; |
|
230 | + $order_class = $field_machine_name.'-delta-order'; |
|
231 | 231 | |
232 | 232 | $current = [ |
233 | 233 | '#type' => 'table', |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | $current[$entity_id] = [ |
305 | 305 | '#attributes' => [ |
306 | 306 | 'class' => ['draggable'], |
307 | - 'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity_id, |
|
307 | + 'data-entity-id' => $entity->getEntityTypeId().':'.$entity_id, |
|
308 | 308 | ], |
309 | 309 | 'display' => $display, |
310 | 310 | 'filename' => ['#markup' => $entity->label()], |
@@ -361,9 +361,9 @@ discard block |
||
361 | 361 | 'wrapper' => $details_id, |
362 | 362 | ], |
363 | 363 | '#submit' => [[get_class($this), 'removeItemSubmit']], |
364 | - '#name' => $field_machine_name . '_remove_' . $entity_id, |
|
364 | + '#name' => $field_machine_name.'_remove_'.$entity_id, |
|
365 | 365 | '#limit_validation_errors' => [array_merge($field_parents, [$field_machine_name, 'target_id'])], |
366 | - '#attributes' => ['data-entity-id' => $entity->getEntityTypeId() . ':' . $entity_id], |
|
366 | + '#attributes' => ['data-entity-id' => $entity->getEntityTypeId().':'.$entity_id], |
|
367 | 367 | '#access' => (bool) $widget_settings['field_widget_remove'], |
368 | 368 | ], |
369 | 369 | '_weight' => [ |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | } |
418 | 418 | |
419 | 419 | // Return ourself as the structure doesn't match the default. |
420 | - usort($return, function ($a, $b) { |
|
420 | + usort($return, function($a, $b) { |
|
421 | 421 | return SortArray::sortByKeyInt($a, $b, '_weight'); |
422 | 422 | }); |
423 | 423 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | $data['validators']['file'] = ['validators' => $this->getFileValidators()]; |
478 | 478 | // Provide context for widgets to enhance their configuration. Currently |
479 | 479 | // we only know that "upload_location" is used. |
480 | - $data['widget_context']['upload_location'] = $settings['uri_scheme'] . '://' . $settings['file_directory']; |
|
480 | + $data['widget_context']['upload_location'] = $settings['uri_scheme'].'://'.$settings['file_directory']; |
|
481 | 481 | return $data; |
482 | 482 | } |
483 | 483 |
@@ -180,8 +180,7 @@ discard block |
||
180 | 180 | // their styles in code. |
181 | 181 | if (isset($image_styles[$image_style_setting])) { |
182 | 182 | $preview_image_style = $this->t('Preview image style: @style', ['@style' => $image_styles[$image_style_setting]]); |
183 | - } |
|
184 | - else { |
|
183 | + } else { |
|
185 | 184 | $preview_image_style = $this->t('No preview image'); |
186 | 185 | } |
187 | 186 | } |
@@ -248,8 +247,7 @@ discard block |
||
248 | 247 | if ($image->isValid()) { |
249 | 248 | $width = $image->getWidth(); |
250 | 249 | $height = $image->getHeight(); |
251 | - } |
|
252 | - else { |
|
250 | + } else { |
|
253 | 251 | $width = $height = NULL; |
254 | 252 | } |
255 | 253 | |
@@ -261,8 +259,7 @@ discard block |
||
261 | 259 | '#style_name' => $widget_settings['preview_image_style'], |
262 | 260 | '#uri' => $uri, |
263 | 261 | ]; |
264 | - } |
|
265 | - else { |
|
262 | + } else { |
|
266 | 263 | $display = $this->entityTypeManager->getViewBuilder('file')->view($entity, $view_mode); |
267 | 264 | } |
268 | 265 | |
@@ -277,8 +274,7 @@ discard block |
||
277 | 274 | if ($field_type == 'file') { |
278 | 275 | $description = $item->description; |
279 | 276 | $display_field = $item->display; |
280 | - } |
|
281 | - elseif ($field_type == 'image') { |
|
277 | + } elseif ($field_type == 'image') { |
|
282 | 278 | $alt = $item->alt; |
283 | 279 | $title = $item->title; |
284 | 280 | } |
@@ -439,8 +435,7 @@ discard block |
||
439 | 435 | $extensions = isset($settings['file_extensions']) ? $settings['file_extensions'] : implode(' ', $supported_extensions); |
440 | 436 | $extensions = array_intersect(explode(' ', $extensions), $supported_extensions); |
441 | 437 | $validators['file_validate_extensions'] = [implode(' ', $extensions)]; |
442 | - } |
|
443 | - elseif (!empty($settings['file_extensions'])) { |
|
438 | + } elseif (!empty($settings['file_extensions'])) { |
|
444 | 439 | $validators['file_validate_extensions'] = [$settings['file_extensions']]; |
445 | 440 | } |
446 | 441 |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | } |
147 | 147 | } |
148 | 148 | |
149 | - $id = Html::getUniqueId('field-' . $this->fieldDefinition->getName() . '-display-settings-wrapper'); |
|
149 | + $id = Html::getUniqueId('field-'.$this->fieldDefinition->getName().'-display-settings-wrapper'); |
|
150 | 150 | $element['field_widget_display'] = [ |
151 | 151 | '#title' => t('Entity display plugin'), |
152 | 152 | '#type' => 'select', |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | '#type' => 'fieldset', |
181 | 181 | '#title' => t('Entity display plugin configuration'), |
182 | 182 | '#tree' => TRUE, |
183 | - '#prefix' => '<div id="' . $id . '">', |
|
183 | + '#prefix' => '<div id="'.$id.'">', |
|
184 | 184 | '#suffix' => '</div>', |
185 | 185 | ]; |
186 | 186 | |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | * A key for form state storage. |
279 | 279 | */ |
280 | 280 | protected function getFormStateKey(FieldItemListInterface $items) { |
281 | - return $items->getEntity()->uuid() . ':' . $items->getFieldDefinition()->getName(); |
|
281 | + return $items->getEntity()->uuid().':'.$items->getFieldDefinition()->getName(); |
|
282 | 282 | } |
283 | 283 | |
284 | 284 | /** |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | } |
316 | 316 | // Submit was triggered by one of the "Remove" buttons. We need to walk |
317 | 317 | // few levels up to read value of "target_id" element. |
318 | - elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], $this->fieldDefinition->getName() . '_remove_') === 0) { |
|
318 | + elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], $this->fieldDefinition->getName().'_remove_') === 0) { |
|
319 | 319 | $parents = array_merge(array_slice($trigger['#parents'], 0, -static::$deleteDepth), ['target_id']); |
320 | 320 | } |
321 | 321 | |
@@ -351,8 +351,8 @@ discard block |
||
351 | 351 | // might result in unpredictable results. |
352 | 352 | $form_state->set(['entity_browser_widget', $this->getFormStateKey($items)], $ids); |
353 | 353 | |
354 | - $hidden_id = Html::getUniqueId('edit-' . $this->fieldDefinition->getName() . '-target-id'); |
|
355 | - $details_id = Html::getUniqueId('edit-' . $this->fieldDefinition->getName()); |
|
354 | + $hidden_id = Html::getUniqueId('edit-'.$this->fieldDefinition->getName().'-target-id'); |
|
355 | + $details_id = Html::getUniqueId('edit-'.$this->fieldDefinition->getName()); |
|
356 | 356 | |
357 | 357 | $element += [ |
358 | 358 | '#id' => $details_id, |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | // We need to repeat ID here as it is otherwise skipped when rendering. |
368 | 368 | '#attributes' => ['id' => $hidden_id], |
369 | 369 | '#default_value' => array_map( |
370 | - function (EntityInterface $item) { return $item->getEntityTypeId() . ':' . $item->id(); }, |
|
370 | + function(EntityInterface $item) { return $item->getEntityTypeId().':'.$item->id(); }, |
|
371 | 371 | $entities |
372 | 372 | ), |
373 | 373 | // #ajax is officially not supported for hidden elements but if we |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | */ |
410 | 410 | public static function processEntityBrowser(&$element, FormStateInterface $form_state, &$complete_form) { |
411 | 411 | $uuid = key($element['#attached']['drupalSettings']['entity_browser']); |
412 | - $element['#attached']['drupalSettings']['entity_browser'][$uuid]['selector'] = '#' . $element['#custom_hidden_id']; |
|
412 | + $element['#attached']['drupalSettings']['entity_browser'][$uuid]['selector'] = '#'.$element['#custom_hidden_id']; |
|
413 | 413 | return $element; |
414 | 414 | } |
415 | 415 | |
@@ -512,7 +512,7 @@ discard block |
||
512 | 512 | '#theme_wrappers' => ['container'], |
513 | 513 | '#attributes' => ['class' => ['entities-list']], |
514 | 514 | 'items' => array_map( |
515 | - function (ContentEntityInterface $entity) use ($field_widget_display, $details_id, $field_parents) { |
|
515 | + function(ContentEntityInterface $entity) use ($field_widget_display, $details_id, $field_parents) { |
|
516 | 516 | $display = $field_widget_display->view($entity); |
517 | 517 | if (is_string($display)) { |
518 | 518 | $display = ['#markup' => $display]; |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | '#theme_wrappers' => ['container'], |
522 | 522 | '#attributes' => [ |
523 | 523 | 'class' => ['item-container', Html::getClass($field_widget_display->getPluginId())], |
524 | - 'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity->id(), |
|
524 | + 'data-entity-id' => $entity->getEntityTypeId().':'.$entity->id(), |
|
525 | 525 | ], |
526 | 526 | 'display' => $display, |
527 | 527 | 'remove_button' => [ |
@@ -532,9 +532,9 @@ discard block |
||
532 | 532 | 'wrapper' => $details_id, |
533 | 533 | ], |
534 | 534 | '#submit' => [[get_class($this), 'removeItemSubmit']], |
535 | - '#name' => $this->fieldDefinition->getName() . '_remove_' . $entity->id(), |
|
535 | + '#name' => $this->fieldDefinition->getName().'_remove_'.$entity->id(), |
|
536 | 536 | '#limit_validation_errors' => [array_merge($field_parents, [$this->fieldDefinition->getName()])], |
537 | - '#attributes' => ['data-entity-id' => $entity->getEntityTypeId() . ':' . $entity->id()], |
|
537 | + '#attributes' => ['data-entity-id' => $entity->getEntityTypeId().':'.$entity->id()], |
|
538 | 538 | '#access' => (bool) $this->getSetting('field_widget_remove'), |
539 | 539 | ], |
540 | 540 | 'edit_button' => [ |
@@ -432,8 +432,7 @@ discard block |
||
432 | 432 | // and use this information to return correct part of the form. |
433 | 433 | if (!empty($trigger['#ajax']['event']) && $trigger['#ajax']['event'] == 'entity_browser_value_updated') { |
434 | 434 | $parents = array_slice($trigger['#array_parents'], 0, -1); |
435 | - } |
|
436 | - elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], '_remove_')) { |
|
435 | + } elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], '_remove_')) { |
|
437 | 436 | $parents = array_slice($trigger['#array_parents'], 0, -static::$deleteDepth); |
438 | 437 | } |
439 | 438 | |
@@ -587,12 +586,10 @@ discard block |
||
587 | 586 | $entity_browser_id = $this->getSetting('entity_browser'); |
588 | 587 | if (empty($entity_browser_id)) { |
589 | 588 | return [t('No entity browser selected.')]; |
590 | - } |
|
591 | - else { |
|
589 | + } else { |
|
592 | 590 | if ($browser = $this->entityTypeManager->getStorage('entity_browser')->load($entity_browser_id)) { |
593 | 591 | $summary[] = t('Entity browser: @browser', ['@browser' => $browser->label()]); |
594 | - } |
|
595 | - else { |
|
592 | + } else { |
|
596 | 593 | drupal_set_message(t('Missing entity browser!'), 'error'); |
597 | 594 | return [t('Missing entity browser!')]; |
598 | 595 | } |
@@ -276,7 +276,7 @@ |
||
276 | 276 | /** |
277 | 277 | * Run widget validators. |
278 | 278 | * |
279 | - * @param array $entities |
|
279 | + * @param \Drupal\Core\Entity\EntityInterface[] $entities |
|
280 | 280 | * Array of entity ids to validate. |
281 | 281 | * @param array $validators |
282 | 282 | * Array of widget validator ids. |
@@ -139,9 +139,9 @@ discard block |
||
139 | 139 | $xpath = new \DOMXPath($dom); |
140 | 140 | foreach ($commands as $command) { |
141 | 141 | if ($command['command'] == 'insert' && $command['method'] == 'replaceWith') { |
142 | - $wrapperNode = $xpath->query('//*[@id="' . ltrim($command['selector'], '#') . '"]')->item(0); |
|
142 | + $wrapperNode = $xpath->query('//*[@id="'.ltrim($command['selector'], '#').'"]')->item(0); |
|
143 | 143 | $newDom = new \DOMDocument(); |
144 | - @$newDom->loadHTML('<div>' . $command['data'] . '</div>'); |
|
144 | + @$newDom->loadHTML('<div>'.$command['data'].'</div>'); |
|
145 | 145 | $newNode = @$dom->importNode($newDom->documentElement->firstChild->firstChild, TRUE); |
146 | 146 | $wrapperNode->parentNode->replaceChild($newNode, $wrapperNode); |
147 | 147 | $content = $dom->saveHTML(); |
@@ -232,14 +232,14 @@ discard block |
||
232 | 232 | $this->assertUrl('/admin/config/content/entity_browser/test_entity_browser/selection_display', ['query' => ['js' => 'nojs']]); |
233 | 233 | |
234 | 234 | $this->drupalPostForm(NULL, [], 'Next'); |
235 | - $this->assertFieldById('edit-table-' . $first_uuid . '-label', 'upload', 'Correct value for widget label found.'); |
|
236 | - $this->assertFieldById('edit-table-' . $first_uuid . '-form-upload-location', 'public://', 'Correct value for upload location found.'); |
|
237 | - $this->assertFieldByXPath("//input[@data-drupal-selector='edit-table-" . $first_uuid . "-form-submit-text']", 'Select files', 'Correct value for submit text found.'); |
|
238 | - $this->assertFieldById('edit-table-' . $second_uuid . '-label', 'entity_form', 'Correct value for widget label found.'); |
|
239 | - $this->assertOptionSelectedWithDrupalSelector('edit-table-' . $second_uuid . '-form-entity-type', 'user', 'Correct value for entity type found.'); |
|
240 | - $this->assertOptionSelectedWithDrupalSelector('edit-table-' . $second_uuid . '-form-bundle-select', 'user', 'Correct value for bundle found.'); |
|
241 | - $this->assertOptionSelectedWithDrupalSelector('edit-table-' . $second_uuid . '-form-form-mode-form-select', 'register', 'Correct value for form modes found.'); |
|
242 | - $this->assertFieldByXPath("//input[@data-drupal-selector='edit-table-" . $second_uuid . "-form-submit-text']", 'But some are more equal than others', 'Correct value for submit text found.'); |
|
235 | + $this->assertFieldById('edit-table-'.$first_uuid.'-label', 'upload', 'Correct value for widget label found.'); |
|
236 | + $this->assertFieldById('edit-table-'.$first_uuid.'-form-upload-location', 'public://', 'Correct value for upload location found.'); |
|
237 | + $this->assertFieldByXPath("//input[@data-drupal-selector='edit-table-".$first_uuid."-form-submit-text']", 'Select files', 'Correct value for submit text found.'); |
|
238 | + $this->assertFieldById('edit-table-'.$second_uuid.'-label', 'entity_form', 'Correct value for widget label found.'); |
|
239 | + $this->assertOptionSelectedWithDrupalSelector('edit-table-'.$second_uuid.'-form-entity-type', 'user', 'Correct value for entity type found.'); |
|
240 | + $this->assertOptionSelectedWithDrupalSelector('edit-table-'.$second_uuid.'-form-bundle-select', 'user', 'Correct value for bundle found.'); |
|
241 | + $this->assertOptionSelectedWithDrupalSelector('edit-table-'.$second_uuid.'-form-form-mode-form-select', 'register', 'Correct value for form modes found.'); |
|
242 | + $this->assertFieldByXPath("//input[@data-drupal-selector='edit-table-".$second_uuid."-form-submit-text']", 'But some are more equal than others', 'Correct value for submit text found.'); |
|
243 | 243 | |
244 | 244 | $this->drupalPostForm(NULL, [], 'Finish'); |
245 | 245 |