Completed
Pull Request — 8.x-1.x (#129)
by Samuel
03:23
created
src/Plugin/Field/FieldWidget/EntityReference.php 4 patches
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -183,8 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
     if (empty($entity_browser_id)) {
185 185
       return [t('No entity browser selected.')];
186
-    }
187
-    else {
186
+    } else {
188 187
       $browser = $this->entityManager->getStorage('entity_browser')
189 188
         ->load($entity_browser_id);
190 189
       $summary[] = t('Entity browser: @browser', ['@browser' => $browser->label()]);
@@ -355,8 +354,7 @@  discard block
 block discarded – undo
355 354
     // information to return correct part of the form.
356 355
     if (!empty($trigger['#ajax']['event']) && $trigger['#ajax']['event'] == 'entity_browser_value_updated') {
357 356
       $parents = array_slice($trigger['#array_parents'], 0, -2);
358
-    }
359
-    elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], '_remove_')) {
357
+    } elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], '_remove_')) {
360 358
       $parents = array_slice($trigger['#array_parents'], 0, -4);
361 359
     }
362 360
 
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -16,8 +16,6 @@
 block discarded – undo
16 16
 use Drupal\Core\Field\WidgetBase;
17 17
 use Drupal\Core\Form\FormStateInterface;
18 18
 use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
19
-use Drupal\entity_browser\Events\Events;
20
-use Drupal\entity_browser\Events\RegisterJSCallbacks;
21 19
 use Drupal\entity_browser\FieldWidgetDisplayManager;
22 20
 use Symfony\Component\DependencyInjection\ContainerInterface;
23 21
 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
Please login to merge, or discard this patch.
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -25,7 +25,6 @@
 block discarded – undo
25 25
 
26 26
 /**
27 27
  * Plugin implementation of the 'entity_reference' widget for entity browser.
28
-
29 28
  * @FieldWidget(
30 29
  *   id = "entity_browser_entity_reference",
31 30
  *   label = @Translation("Entity browser"),
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
       }
148 148
     }
149 149
 
150
-    $id = Html::getUniqueId('field-' . $this->fieldDefinition->getName() . '-display-settings-wrapper');
150
+    $id = Html::getUniqueId('field-'.$this->fieldDefinition->getName().'-display-settings-wrapper');
151 151
     $element['field_widget_display'] = [
152 152
       '#title' => t('Entity display plugin'),
153 153
       '#type' => 'select',
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
       '#type' => 'fieldset',
182 182
       '#title' => t('Entity display plugin configuration'),
183 183
       '#tree' => TRUE,
184
-      '#prefix' => '<div id="' . $id . '">',
184
+      '#prefix' => '<div id="'.$id.'">',
185 185
       '#suffix' => '</div>',
186 186
     ];
187 187
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
       }
269 269
       // Submit was triggered by one of the "Remove" buttons. We need to walk
270 270
       // few levels up to read value of "target_id" element.
271
-      elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], $this->fieldDefinition->getName() . '_remove_') === 0) {
271
+      elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], $this->fieldDefinition->getName().'_remove_') === 0) {
272 272
         $parents = array_merge(array_slice($trigger['#parents'], 0, -static::$deleteDepth), ['target_id']);
273 273
       }
274 274
 
@@ -291,8 +291,8 @@  discard block
 block discarded – undo
291 291
     }
292 292
     $ids = array_filter($ids);
293 293
 
294
-    $hidden_id = Html::getUniqueId('edit-' . $this->fieldDefinition->getName() . '-target-id');
295
-    $details_id = Html::getUniqueId('edit-' . $this->fieldDefinition->getName());
294
+    $hidden_id = Html::getUniqueId('edit-'.$this->fieldDefinition->getName().'-target-id');
295
+    $details_id = Html::getUniqueId('edit-'.$this->fieldDefinition->getName());
296 296
     /** @var \Drupal\entity_browser\EntityBrowserInterface $entity_browser */
297 297
     $entity_browser = $this->entityManager->getStorage('entity_browser')->load($this->getSetting('entity_browser'));
298 298
 
@@ -418,7 +418,7 @@  discard block
 block discarded – undo
418 418
       '#theme_wrappers' => ['container'],
419 419
       '#attributes' => ['class' => ['entities-list']],
420 420
       'items' => array_map(
421
-        function (ContentEntityInterface $entity) use ($field_widget_display, $details_id, $field_parents) {
421
+        function(ContentEntityInterface $entity) use ($field_widget_display, $details_id, $field_parents) {
422 422
           $display = $field_widget_display->view($entity);
423 423
           if (is_string($display)) {
424 424
             $display = ['#markup' => $display];
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
                 'wrapper' => $details_id,
439 439
               ],
440 440
               '#submit' => [[get_class($this), 'removeItemSubmit']],
441
-              '#name' => $this->fieldDefinition->getName() . '_remove_' . $entity->id(),
441
+              '#name' => $this->fieldDefinition->getName().'_remove_'.$entity->id(),
442 442
               '#limit_validation_errors' => [array_merge($field_parents, [$this->fieldDefinition->getName()])],
443 443
               '#attributes' => ['data-entity-id' => $entity->id()],
444 444
               '#access' => (bool) $this->getSetting('field_widget_remove')
Please login to merge, or discard this patch.
src/Plugin/views/display/EntityBrowser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
         $form_element_row_id = $row_id;
91 91
 
92 92
         $substitutions[] = [
93
-          'placeholder' => '<!--form-item-entity_browser_select--' . $form_element_row_id . '-->',
93
+          'placeholder' => '<!--form-item-entity_browser_select--'.$form_element_row_id.'-->',
94 94
           'field_name' => 'entity_browser_select',
95 95
           'row_id' => $form_element_row_id,
96 96
         ];
Please login to merge, or discard this patch.
src/RouteSubscriber.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@
 block discarded – undo
62 62
       /** @var $browser \Drupal\entity_browser\EntityBrowserInterface */
63 63
       $browser = $this->browserStorage->load($id);
64 64
       if ($route = $browser->route()) {
65
-        $collection->add('entity_browser.' . $browser->id(), $route);
65
+        $collection->add('entity_browser.'.$browser->id(), $route);
66 66
       }
67 67
     }
68 68
 
Please login to merge, or discard this patch.
src/WidgetSelectorInterface.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
    * @return array
31 31
    *   Form structure.
32 32
    */
33
-  public function getForm(array &$form, FormStateInterface &$form_state);
33
+  public function getForm(array &$form, FormStateInterface&$form_state);
34 34
 
35 35
   /**
36 36
    * Sets the default widget.
Please login to merge, or discard this patch.
src/Plugin/EntityBrowser/Display/IFrame.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -134,7 +134,7 @@  discard block
 block discarded – undo
134 134
     // info.
135 135
     $event_object = new RegisterJSCallbacks($this->configuration['entity_browser_id'], $uuid);
136 136
     $event_object->registerCallback('Drupal.entityBrowser.selectionCompleted');
137
-    $event = $this->eventDispatcher->dispatch(Events::REGISTER_JS_CALLBACKS, $event_object );
137
+    $event = $this->eventDispatcher->dispatch(Events::REGISTER_JS_CALLBACKS, $event_object);
138 138
     $original_path = $this->currentPath->getPath();
139 139
     return [
140 140
       '#theme_wrappers' => ['container'],
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
             'entity_browser' => [
155 155
               'iframe' => [
156 156
                 $uuid => [
157
-                  'src' => Url::fromRoute('entity_browser.' . $this->configuration['entity_browser_id'], [], [
157
+                  'src' => Url::fromRoute('entity_browser.'.$this->configuration['entity_browser_id'], [], [
158 158
                     'query' => [
159 159
                       'uuid' => $uuid,
160 160
                       'original_path' => $original_path,
@@ -192,13 +192,13 @@  discard block
 block discarded – undo
192 192
   public function propagateSelection(FilterResponseEvent $event) {
193 193
     $render = [
194 194
       'labels' => [
195
-        '#markup' => 'Labels: ' . implode(', ', array_map(function (EntityInterface $item) {return $item->label();}, $this->entities)),
195
+        '#markup' => 'Labels: '.implode(', ', array_map(function(EntityInterface $item) {return $item->label(); }, $this->entities)),
196 196
         '#attached' => [
197 197
           'library' => ['entity_browser/iframe_selection'],
198 198
           'drupalSettings' => [
199 199
             'entity_browser' => [
200 200
               'iframe' => [
201
-                'entities' => array_map(function (EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()];}, $this->entities),
201
+                'entities' => array_map(function(EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; }, $this->entities),
202 202
                 'uuid' => $this->request->query->get('uuid'),
203 203
               ],
204 204
             ],
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
    * {@inheritdoc}
225 225
    */
226 226
   public function path() {
227
-    return '/entity-browser/iframe/' . $this->configuration['entity_browser_id'];
227
+    return '/entity-browser/iframe/'.$this->configuration['entity_browser_id'];
228 228
   }
229 229
 
230 230
 }
Please login to merge, or discard this patch.
src/Controllers/EntityBrowserController.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -116,8 +116,7 @@
 block discarded – undo
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
   }
Please login to merge, or discard this patch.
src/Plugin/views/field/SelectForm.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
    * {@inheritdoc}
24 24
    */
25 25
   public function render(ResultRow $values) {
26
-    return ViewsRenderPipelineMarkup::create('<!--form-item-' . $this->options['id'] . '--' . $values->index . '-->');
26
+    return ViewsRenderPipelineMarkup::create('<!--form-item-'.$this->options['id'].'--'.$values->index.'-->');
27 27
   }
28 28
 
29 29
   /**
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
           '#type' => 'checkbox',
63 63
           '#title' => $this->t('Select this item'),
64 64
           '#title_display' => 'invisible',
65
-          '#return_value' => $entity->getEntityTypeId() . ':' . $entity->id(),
65
+          '#return_value' => $entity->getEntityTypeId().':'.$entity->id(),
66 66
           '#attributes' => ['name' => "entity_browser_select[$row_index]"],
67 67
           '#default_value' => NULL,
68 68
         ];
Please login to merge, or discard this patch.