Completed
Push — 8.x-1.x ( 68b834...3217ba )
by Janez
02:45 queued 41s
created
src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -158,7 +158,7 @@  discard block
 block discarded – undo
158 158
       }
159 159
     }
160 160
 
161
-    $id = Html::getUniqueId('field-' . $this->fieldDefinition->getName() . '-display-settings-wrapper');
161
+    $id = Html::getUniqueId('field-'.$this->fieldDefinition->getName().'-display-settings-wrapper');
162 162
     $element['field_widget_display'] = [
163 163
       '#title' => $this->t('Entity display plugin'),
164 164
       '#type' => 'select',
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
       '#type' => 'fieldset',
209 209
       '#title' => $this->t('Entity display plugin configuration'),
210 210
       '#tree' => TRUE,
211
-      '#prefix' => '<div id="' . $id . '">',
211
+      '#prefix' => '<div id="'.$id.'">',
212 212
       '#suffix' => '</div>',
213 213
     ];
214 214
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
    *   A key for form state storage.
292 292
    */
293 293
   protected function getFormStateKey(FieldItemListInterface $items) {
294
-    return $items->getEntity()->uuid() . ':' . $items->getFieldDefinition()->getName();
294
+    return $items->getEntity()->uuid().':'.$items->getFieldDefinition()->getName();
295 295
   }
296 296
 
297 297
   /**
@@ -303,7 +303,7 @@  discard block
 block discarded – undo
303 303
 
304 304
     // Get correct ordered list of entity IDs.
305 305
     $ids = array_map(
306
-      function (EntityInterface $entity) {
306
+      function(EntityInterface $entity) {
307 307
         return $entity->id();
308 308
       },
309 309
       $entities
@@ -317,8 +317,8 @@  discard block
 block discarded – undo
317 317
     // might result in unpredictable results.
318 318
     $form_state->set(['entity_browser_widget', $this->getFormStateKey($items)], $ids);
319 319
 
320
-    $hidden_id = Html::getUniqueId('edit-' . $this->fieldDefinition->getName() . '-target-id');
321
-    $details_id = Html::getUniqueId('edit-' . $this->fieldDefinition->getName());
320
+    $hidden_id = Html::getUniqueId('edit-'.$this->fieldDefinition->getName().'-target-id');
321
+    $details_id = Html::getUniqueId('edit-'.$this->fieldDefinition->getName());
322 322
 
323 323
     $element += [
324 324
       '#id' => $details_id,
@@ -333,8 +333,8 @@  discard block
 block discarded – undo
333 333
         // We need to repeat ID here as it is otherwise skipped when rendering.
334 334
         '#attributes' => ['id' => $hidden_id],
335 335
         '#default_value' => implode(' ', array_map(
336
-            function (EntityInterface $item) {
337
-              return $item->getEntityTypeId() . ':' . $item->id();
336
+            function(EntityInterface $item) {
337
+              return $item->getEntityTypeId().':'.$item->id();
338 338
             },
339 339
             $entities
340 340
         )),
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
    */
387 387
   public static function processEntityBrowser(&$element, FormStateInterface $form_state, &$complete_form) {
388 388
     $uuid = key($element['#attached']['drupalSettings']['entity_browser']);
389
-    $element['#attached']['drupalSettings']['entity_browser'][$uuid]['selector'] = '#' . $element['#custom_hidden_id'];
389
+    $element['#attached']['drupalSettings']['entity_browser'][$uuid]['selector'] = '#'.$element['#custom_hidden_id'];
390 390
     return $element;
391 391
   }
392 392
 
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
       '#theme_wrappers' => ['container'],
497 497
       '#attributes' => ['class' => $classes],
498 498
       'items' => array_map(
499
-        function (ContentEntityInterface $entity, $row_id) use ($field_widget_display, $details_id, $field_parents) {
499
+        function(ContentEntityInterface $entity, $row_id) use ($field_widget_display, $details_id, $field_parents) {
500 500
           $display = $field_widget_display->view($entity);
501 501
           $edit_button_access = $this->getSetting('field_widget_edit');
502 502
           if ($entity->getEntityTypeId() == 'file') {
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
             '#theme_wrappers' => ['container'],
513 513
             '#attributes' => [
514 514
               'class' => ['item-container', Html::getClass($field_widget_display->getPluginId())],
515
-              'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity->id(),
515
+              'data-entity-id' => $entity->getEntityTypeId().':'.$entity->id(),
516 516
               'data-row-id' => $row_id,
517 517
             ],
518 518
             'display' => $display,
@@ -524,10 +524,10 @@  discard block
 block discarded – undo
524 524
                 'wrapper' => $details_id,
525 525
               ],
526 526
               '#submit' => [[get_class($this), 'removeItemSubmit']],
527
-              '#name' => $this->fieldDefinition->getName() . '_remove_' . $entity->id() . '_' . $row_id . '_' . md5(json_encode($field_parents)),
527
+              '#name' => $this->fieldDefinition->getName().'_remove_'.$entity->id().'_'.$row_id.'_'.md5(json_encode($field_parents)),
528 528
               '#limit_validation_errors' => [array_merge($field_parents, [$this->fieldDefinition->getName()])],
529 529
               '#attributes' => [
530
-                'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity->id(),
530
+                'data-entity-id' => $entity->getEntityTypeId().':'.$entity->id(),
531 531
                 'data-row-id' => $row_id,
532 532
               ],
533 533
               '#access' => (bool) $this->getSetting('field_widget_remove'),
@@ -666,7 +666,7 @@  discard block
 block discarded – undo
666 666
       }
667 667
       // Submit was triggered by one of the "Remove" buttons. We need to walk
668 668
       // few levels up to read value of "target_id" element.
669
-      elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], $this->fieldDefinition->getName() . '_remove_') === 0) {
669
+      elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], $this->fieldDefinition->getName().'_remove_') === 0) {
670 670
         $parents = array_merge(array_slice($trigger['#parents'], 0, -static::$deleteDepth), ['target_id']);
671 671
       }
672 672
 
@@ -723,7 +723,7 @@  discard block
 block discarded – undo
723 723
     // If an entity browser is being used in this widget, add it as a config
724 724
     // dependency.
725 725
     if ($browser_name = $this->getSetting('entity_browser')) {
726
-      $dependencies['config'][] = 'entity_browser.browser.' . $browser_name;
726
+      $dependencies['config'][] = 'entity_browser.browser.'.$browser_name;
727 727
     }
728 728
 
729 729
     return $dependencies;
Please login to merge, or discard this patch.