Completed
Push — 8.x-1.x ( c9606a...ff820e )
by Janez
02:15
created
src/Plugin/Field/FieldWidget/EntityReferenceBrowserWidget.php 1 patch
Spacing   +15 added lines, -15 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',
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
       '#type' => 'fieldset',
190 190
       '#title' => $this->t('Entity display plugin configuration'),
191 191
       '#tree' => TRUE,
192
-      '#prefix' => '<div id="' . $id . '">',
192
+      '#prefix' => '<div id="'.$id.'">',
193 193
       '#suffix' => '</div>',
194 194
     ];
195 195
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
    *   A key for form state storage.
273 273
    */
274 274
   protected function getFormStateKey(FieldItemListInterface $items) {
275
-    return $items->getEntity()->uuid() . ':' . $items->getFieldDefinition()->getName();
275
+    return $items->getEntity()->uuid().':'.$items->getFieldDefinition()->getName();
276 276
   }
277 277
 
278 278
   /**
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 
285 285
     // Get correct ordered list of entity IDs.
286 286
     $ids = array_map(
287
-      function (EntityInterface $entity) {
287
+      function(EntityInterface $entity) {
288 288
         return $entity->id();
289 289
       },
290 290
       $entities
@@ -298,8 +298,8 @@  discard block
 block discarded – undo
298 298
     // might result in unpredictable results.
299 299
     $form_state->set(['entity_browser_widget', $this->getFormStateKey($items)], $ids);
300 300
 
301
-    $hidden_id = Html::getUniqueId('edit-' . $this->fieldDefinition->getName() . '-target-id');
302
-    $details_id = Html::getUniqueId('edit-' . $this->fieldDefinition->getName());
301
+    $hidden_id = Html::getUniqueId('edit-'.$this->fieldDefinition->getName().'-target-id');
302
+    $details_id = Html::getUniqueId('edit-'.$this->fieldDefinition->getName());
303 303
 
304 304
     $element += [
305 305
       '#id' => $details_id,
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
         // We need to repeat ID here as it is otherwise skipped when rendering.
315 315
         '#attributes' => ['id' => $hidden_id],
316 316
         '#default_value' => implode(' ', array_map(
317
-            function (EntityInterface $item) {
318
-              return $item->getEntityTypeId() . ':' . $item->id();
317
+            function(EntityInterface $item) {
318
+              return $item->getEntityTypeId().':'.$item->id();
319 319
             },
320 320
             $entities
321 321
         )),
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
    */
365 365
   public static function processEntityBrowser(&$element, FormStateInterface $form_state, &$complete_form) {
366 366
     $uuid = key($element['#attached']['drupalSettings']['entity_browser']);
367
-    $element['#attached']['drupalSettings']['entity_browser'][$uuid]['selector'] = '#' . $element['#custom_hidden_id'];
367
+    $element['#attached']['drupalSettings']['entity_browser'][$uuid]['selector'] = '#'.$element['#custom_hidden_id'];
368 368
     return $element;
369 369
   }
370 370
 
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
       '#theme_wrappers' => ['container'],
470 470
       '#attributes' => ['class' => ['entities-list']],
471 471
       'items' => array_map(
472
-        function (ContentEntityInterface $entity, $row_id) use ($field_widget_display, $details_id, $field_parents) {
472
+        function(ContentEntityInterface $entity, $row_id) use ($field_widget_display, $details_id, $field_parents) {
473 473
           $display = $field_widget_display->view($entity);
474 474
           if (is_string($display)) {
475 475
             $display = ['#markup' => $display];
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
             '#theme_wrappers' => ['container'],
479 479
             '#attributes' => [
480 480
               'class' => ['item-container', Html::getClass($field_widget_display->getPluginId())],
481
-              'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity->id(),
481
+              'data-entity-id' => $entity->getEntityTypeId().':'.$entity->id(),
482 482
               'data-row-id' => $row_id,
483 483
             ],
484 484
             'display' => $display,
@@ -490,10 +490,10 @@  discard block
 block discarded – undo
490 490
                 'wrapper' => $details_id,
491 491
               ],
492 492
               '#submit' => [[get_class($this), 'removeItemSubmit']],
493
-              '#name' => $this->fieldDefinition->getName() . '_remove_' . $entity->id() . '_' . $row_id . '_' . md5(json_encode($field_parents)),
493
+              '#name' => $this->fieldDefinition->getName().'_remove_'.$entity->id().'_'.$row_id.'_'.md5(json_encode($field_parents)),
494 494
               '#limit_validation_errors' => [array_merge($field_parents, [$this->fieldDefinition->getName()])],
495 495
               '#attributes' => [
496
-                'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity->id(),
496
+                'data-entity-id' => $entity->getEntityTypeId().':'.$entity->id(),
497 497
                 'data-row-id' => $row_id,
498 498
               ],
499 499
               '#access' => (bool) $this->getSetting('field_widget_remove'),
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
       }
632 632
       // Submit was triggered by one of the "Remove" buttons. We need to walk
633 633
       // few levels up to read value of "target_id" element.
634
-      elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], $this->fieldDefinition->getName() . '_remove_') === 0) {
634
+      elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], $this->fieldDefinition->getName().'_remove_') === 0) {
635 635
         $parents = array_merge(array_slice($trigger['#parents'], 0, -static::$deleteDepth), ['target_id']);
636 636
       }
637 637
 
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
     // If an entity browser is being used in this widget, add it as a config
689 689
     // dependency.
690 690
     if ($browser_name = $this->getSetting('entity_browser')) {
691
-      $dependencies['config'][] = 'entity_browser.browser.' . $browser_name;
691
+      $dependencies['config'][] = 'entity_browser.browser.'.$browser_name;
692 692
     }
693 693
 
694 694
     return $dependencies;
Please login to merge, or discard this patch.
src/Plugin/Field/FieldWidget/FileBrowserWidget.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
     $delta = 0;
218 218
 
219
-    $order_class = $field_machine_name . '-delta-order';
219
+    $order_class = $field_machine_name.'-delta-order';
220 220
 
221 221
     $current = [
222 222
       '#type' => 'table',
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
       $current[$entity_id] = [
284 284
         '#attributes' => [
285 285
           'class' => ['draggable'],
286
-          'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity_id,
286
+          'data-entity-id' => $entity->getEntityTypeId().':'.$entity_id,
287 287
           'data-row-id' => $delta,
288 288
         ],
289 289
       ];
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
             'options' => ['query' => ['details_id' => $details_id]],
356 356
           ],
357 357
           '#attributes' => [
358
-            'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity->id(),
358
+            'data-entity-id' => $entity->getEntityTypeId().':'.$entity->id(),
359 359
             'data-row-id' => $delta,
360 360
           ],
361 361
           '#access' => $can_edit,
@@ -368,10 +368,10 @@  discard block
 block discarded – undo
368 368
             'wrapper' => $details_id,
369 369
           ],
370 370
           '#submit' => [[get_class($this), 'removeItemSubmit']],
371
-          '#name' => $field_machine_name . '_remove_' . $entity_id . '_' . md5(json_encode($field_parents)),
371
+          '#name' => $field_machine_name.'_remove_'.$entity_id.'_'.md5(json_encode($field_parents)),
372 372
           '#limit_validation_errors' => [array_merge($field_parents, [$field_machine_name, 'target_id'])],
373 373
           '#attributes' => [
374
-            'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity->id(),
374
+            'data-entity-id' => $entity->getEntityTypeId().':'.$entity->id(),
375 375
             'data-row-id' => $delta,
376 376
           ],
377 377
           '#access' => (bool) $widget_settings['field_widget_remove'],
@@ -429,7 +429,7 @@  discard block
 block discarded – undo
429 429
     }
430 430
 
431 431
     // Return ourself as the structure doesn't match the default.
432
-    usort($return, function ($a, $b) {
432
+    usort($return, function($a, $b) {
433 433
       return SortArray::sortByKeyInt($a, $b, '_weight');
434 434
     });
435 435
 
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
     $data['validators']['file'] = ['validators' => $this->getFileValidators()];
490 490
     // Provide context for widgets to enhance their configuration. Currently
491 491
     // we only know that "upload_location" is used.
492
-    $data['widget_context']['upload_location'] = $settings['uri_scheme'] . '://' . $settings['file_directory'];
492
+    $data['widget_context']['upload_location'] = $settings['uri_scheme'].'://'.$settings['file_directory'];
493 493
     return $data;
494 494
   }
495 495
 
Please login to merge, or discard this patch.