@@ -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 | }, |
@@ -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 |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | '#theme_wrappers' => ['container'], |
145 | 145 | 'path' => [ |
146 | 146 | '#type' => 'hidden', |
147 | - '#value' => Url::fromRoute('entity_browser.' . $this->configuration['entity_browser_id'], [], $data['query_parameters'])->toString(), |
|
147 | + '#value' => Url::fromRoute('entity_browser.'.$this->configuration['entity_browser_id'], [], $data['query_parameters'])->toString(), |
|
148 | 148 | ], |
149 | 149 | 'open_modal' => [ |
150 | 150 | '#type' => 'submit', |
@@ -206,13 +206,13 @@ discard block |
||
206 | 206 | 'height' => $this->configuration['height'] - 90, |
207 | 207 | 'frameborder' => 0, |
208 | 208 | 'style' => 'padding:0', |
209 | - 'name' => 'entity_browser_iframe_' . Html::cleanCssIdentifier($element_name), |
|
209 | + 'name' => 'entity_browser_iframe_'.Html::cleanCssIdentifier($element_name), |
|
210 | 210 | ], |
211 | 211 | ]; |
212 | 212 | $html = drupal_render($content); |
213 | 213 | |
214 | 214 | $response = new AjaxResponse(); |
215 | - $response->addCommand(new OpenDialogCommand('#' . Html::getUniqueId($field_name . '-' . $element_name . '-dialog'), $this->configuration['link_text'], $html, [ |
|
215 | + $response->addCommand(new OpenDialogCommand('#'.Html::getUniqueId($field_name.'-'.$element_name.'-dialog'), $this->configuration['link_text'], $html, [ |
|
216 | 216 | 'width' => 'auto', |
217 | 217 | 'height' => 'auto', |
218 | 218 | 'modal' => TRUE, |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | public function propagateSelection(FilterResponseEvent $event) { |
311 | 311 | $render = [ |
312 | 312 | 'labels' => [ |
313 | - '#markup' => 'Labels: ' . implode(', ', array_map(function (EntityInterface $item) { |
|
313 | + '#markup' => 'Labels: '.implode(', ', array_map(function(EntityInterface $item) { |
|
314 | 314 | return $item->label(); |
315 | 315 | }, $this->entities)), |
316 | 316 | '#attached' => [ |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | 'drupalSettings' => [ |
319 | 319 | 'entity_browser' => [ |
320 | 320 | 'modal' => [ |
321 | - 'entities' => array_map(function (EntityInterface $item) { |
|
321 | + 'entities' => array_map(function(EntityInterface $item) { |
|
322 | 322 | return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; |
323 | 323 | }, $this->entities), |
324 | 324 | 'uuid' => $this->request->query->get('uuid'), |
@@ -336,7 +336,7 @@ discard block |
||
336 | 336 | * {@inheritdoc} |
337 | 337 | */ |
338 | 338 | public function path() { |
339 | - return '/entity-browser/modal/' . $this->configuration['entity_browser_id']; |
|
339 | + return '/entity-browser/modal/'.$this->configuration['entity_browser_id']; |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | /** |
@@ -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 |
@@ -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' => [ |