Completed
Push — 8.x-1.x ( 8a7aec...a87349 )
by Janez
03:26
created
src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
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' => $this->t('Entity display plugin'),
152 152
       '#type' => 'select',
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
       '#type' => 'fieldset',
189 189
       '#title' => $this->t('Entity display plugin configuration'),
190 190
       '#tree' => TRUE,
191
-      '#prefix' => '<div id="' . $id . '">',
191
+      '#prefix' => '<div id="'.$id.'">',
192 192
       '#suffix' => '</div>',
193 193
     ];
194 194
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
    *   A key for form state storage.
272 272
    */
273 273
   protected function getFormStateKey(FieldItemListInterface $items) {
274
-    return $items->getEntity()->uuid() . ':' . $items->getFieldDefinition()->getName();
274
+    return $items->getEntity()->uuid().':'.$items->getFieldDefinition()->getName();
275 275
   }
276 276
 
277 277
   /**
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 
284 284
     // Get correct ordered list of entity IDs.
285 285
     $ids = array_map(
286
-      function (EntityInterface $entity) {
286
+      function(EntityInterface $entity) {
287 287
         return $entity->id();
288 288
       },
289 289
       $entities
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
     // might result in unpredictable results.
298 298
     $form_state->set(['entity_browser_widget', $this->getFormStateKey($items)], $ids);
299 299
 
300
-    $hidden_id = Html::getUniqueId('edit-' . $this->fieldDefinition->getName() . '-target-id');
301
-    $details_id = Html::getUniqueId('edit-' . $this->fieldDefinition->getName());
300
+    $hidden_id = Html::getUniqueId('edit-'.$this->fieldDefinition->getName().'-target-id');
301
+    $details_id = Html::getUniqueId('edit-'.$this->fieldDefinition->getName());
302 302
 
303 303
     $element += [
304 304
       '#id' => $details_id,
@@ -313,8 +313,8 @@  discard block
 block discarded – undo
313 313
         // We need to repeat ID here as it is otherwise skipped when rendering.
314 314
         '#attributes' => ['id' => $hidden_id],
315 315
         '#default_value' => implode(' ', array_map(
316
-            function (EntityInterface $item) {
317
-              return $item->getEntityTypeId() . ':' . $item->id();
316
+            function(EntityInterface $item) {
317
+              return $item->getEntityTypeId().':'.$item->id();
318 318
             },
319 319
             $entities
320 320
         )),
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
    */
364 364
   public static function processEntityBrowser(&$element, FormStateInterface $form_state, &$complete_form) {
365 365
     $uuid = key($element['#attached']['drupalSettings']['entity_browser']);
366
-    $element['#attached']['drupalSettings']['entity_browser'][$uuid]['selector'] = '#' . $element['#custom_hidden_id'];
366
+    $element['#attached']['drupalSettings']['entity_browser'][$uuid]['selector'] = '#'.$element['#custom_hidden_id'];
367 367
     return $element;
368 368
   }
369 369
 
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
       '#theme_wrappers' => ['container'],
469 469
       '#attributes' => ['class' => ['entities-list']],
470 470
       'items' => array_map(
471
-        function (ContentEntityInterface $entity, $row_id) use ($field_widget_display, $details_id, $field_parents) {
471
+        function(ContentEntityInterface $entity, $row_id) use ($field_widget_display, $details_id, $field_parents) {
472 472
           $display = $field_widget_display->view($entity);
473 473
           if (is_string($display)) {
474 474
             $display = ['#markup' => $display];
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
             '#theme_wrappers' => ['container'],
478 478
             '#attributes' => [
479 479
               'class' => ['item-container', Html::getClass($field_widget_display->getPluginId())],
480
-              'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity->id(),
480
+              'data-entity-id' => $entity->getEntityTypeId().':'.$entity->id(),
481 481
               'data-row-id' => $row_id,
482 482
             ],
483 483
             'display' => $display,
@@ -489,10 +489,10 @@  discard block
 block discarded – undo
489 489
                 'wrapper' => $details_id,
490 490
               ],
491 491
               '#submit' => [[get_class($this), 'removeItemSubmit']],
492
-              '#name' => $this->fieldDefinition->getName() . '_remove_' . $entity->id() . '_' . $row_id,
492
+              '#name' => $this->fieldDefinition->getName().'_remove_'.$entity->id().'_'.$row_id,
493 493
               '#limit_validation_errors' => [array_merge($field_parents, [$this->fieldDefinition->getName()])],
494 494
               '#attributes' => [
495
-                'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity->id(),
495
+                'data-entity-id' => $entity->getEntityTypeId().':'.$entity->id(),
496 496
                 'data-row-id' => $row_id,
497 497
               ],
498 498
               '#access' => (bool) $this->getSetting('field_widget_remove'),
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
       }
625 625
       // Submit was triggered by one of the "Remove" buttons. We need to walk
626 626
       // few levels up to read value of "target_id" element.
627
-      elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], $this->fieldDefinition->getName() . '_remove_') === 0) {
627
+      elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], $this->fieldDefinition->getName().'_remove_') === 0) {
628 628
         $parents = array_merge(array_slice($trigger['#parents'], 0, -static::$deleteDepth), ['target_id']);
629 629
       }
630 630
 
Please login to merge, or discard this patch.