Completed
Push — 8.x-1.x ( b30d75...4eb492 )
by Janez
02:40
created
src/Plugin/EntityBrowser/Display/Modal.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -279,7 +279,7 @@
 block discarded – undo
279 279
   /**
280 280
    * Helper function to return commands to return in AjaxResponse.
281 281
    *
282
-   * @return array
282
+   * @return SelectEntitiesCommand[]
283 283
    *   An array of ajax commands.
284 284
    */
285 285
   public function getAjaxCommands(FormStateInterface $form_state) {
Please login to merge, or discard this patch.
Unused Use Statements   -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,6 @@  discard block
 block discarded – undo
12 12
 use Drupal\Core\Entity\EntityInterface;
13 13
 use Drupal\Core\Routing\RouteMatchInterface;
14 14
 use Drupal\Core\Url;
15
-use Drupal\entity_browser\DisplayAjaxInterface;
16 15
 use Drupal\entity_browser\DisplayBase;
17 16
 use Drupal\entity_browser\DisplayRouterInterface;
18 17
 use Drupal\entity_browser\Events\Events;
@@ -21,7 +20,6 @@  discard block
 block discarded – undo
21 20
 use Symfony\Component\EventDispatcher\EventDispatcherInterface;
22 21
 use Drupal\Core\Path\CurrentPathStack;
23 22
 use Drupal\Core\Ajax\AjaxResponse;
24
-use Drupal\Core\Ajax\CloseDialogCommand;
25 23
 use Drupal\entity_browser\Ajax\SelectEntitiesCommand;
26 24
 use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
27 25
 use Symfony\Component\HttpKernel\KernelEvents;
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
69 69
    */
70 70
   protected $uuid = NULL;
71 71
 
72
- /**
72
+  /**
73 73
    * Current request.
74 74
    *
75 75
    * @var \Symfony\Component\HttpFoundation\Request
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
       '#theme_wrappers' => ['container'],
143 143
       'path' => [
144 144
         '#type' => 'hidden',
145
-        '#value' => Url::fromRoute('entity_browser.' . $this->configuration['entity_browser_id'], [], [
145
+        '#value' => Url::fromRoute('entity_browser.'.$this->configuration['entity_browser_id'], [], [
146 146
           'query' => [
147 147
             'uuid' => $uuid,
148 148
             'original_path' => $original_path,
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
         '#value' => $this->configuration['link_text'],
155 155
         '#limit_validation_errors' => [],
156 156
         '#submit' => [],
157
-        '#name' => 'op_' . $this->configuration['entity_browser_id'],
157
+        '#name' => 'op_'.$this->configuration['entity_browser_id'],
158 158
         '#ajax' => [
159 159
           'callback' => [$this, 'openModal'],
160 160
           'event' => 'click',
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
           'data-uuid' => $uuid,
164 164
         ],
165 165
         '#attached' => [
166
-          'library' => ['core/drupal.dialog.ajax',  'entity_browser/modal'],
166
+          'library' => ['core/drupal.dialog.ajax', 'entity_browser/modal'],
167 167
           'drupalSettings' => [
168 168
             'entity_browser' => [
169 169
               'modal' => [
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
    *   An array of ajax commands.
284 284
    */
285 285
   public function getAjaxCommands(FormStateInterface $form_state) {
286
-    $entities = array_map(function(EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()];}, $form_state->get(['entity_browser', 'selected_entities']));
286
+    $entities = array_map(function(EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; }, $form_state->get(['entity_browser', 'selected_entities']));
287 287
 
288 288
     $commands = array();
289 289
     $commands[] = new SelectEntitiesCommand($this->uuid, $entities);
@@ -303,13 +303,13 @@  discard block
 block discarded – undo
303 303
   public function propagateSelection(FilterResponseEvent $event) {
304 304
     $render = [
305 305
       'labels' => [
306
-        '#markup' => 'Labels: ' . implode(', ', array_map(function (EntityInterface $item) {return $item->label();}, $this->entities)),
306
+        '#markup' => 'Labels: '.implode(', ', array_map(function(EntityInterface $item) {return $item->label(); }, $this->entities)),
307 307
         '#attached' => [
308 308
           'library' => ['entity_browser/modal_selection'],
309 309
           'drupalSettings' => [
310 310
             'entity_browser' => [
311 311
               'modal' => [
312
-                'entities' => array_map(function (EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()];}, $this->entities),
312
+                'entities' => array_map(function(EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; }, $this->entities),
313 313
                 'uuid' => $this->request->query->get('uuid'),
314 314
               ],
315 315
             ],
@@ -325,7 +325,7 @@  discard block
 block discarded – undo
325 325
    * {@inheritdoc}
326 326
    */
327 327
   public function path() {
328
-    return '/entity-browser/modal/' . $this->configuration['entity_browser_id'];
328
+    return '/entity-browser/modal/'.$this->configuration['entity_browser_id'];
329 329
   }
330 330
 
331 331
   /**
Please login to merge, or discard this patch.
src/Plugin/Field/FieldWidget/EntityReference.php 4 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -54,8 +54,6 @@
 block discarded – undo
54 54
   /**
55 55
    * Constructs widget plugin.
56 56
    *
57
-   * @param array $configuration
58
-   *   A configuration array containing information about the plugin instance.
59 57
    * @param string $plugin_id
60 58
    *   The plugin_id for the plugin instance.
61 59
    * @param mixed $plugin_definition
Please login to merge, or discard this patch.
Indentation   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -24,7 +24,6 @@  discard block
 block discarded – undo
24 24
 
25 25
 /**
26 26
  * Plugin implementation of the 'entity_reference' widget for entity browser.
27
-
28 27
  * @FieldWidget(
29 28
  *   id = "entity_browser_entity_reference",
30 29
  *   label = @Translation("Entity browser"),
@@ -174,8 +173,8 @@  discard block
 block discarded – undo
174 173
   }
175 174
 
176 175
     /**
177
-   * {@inheritdoc}
178
-   */
176
+     * {@inheritdoc}
177
+     */
179 178
   public function settingsSummary() {
180 179
     $summary = [];
181 180
     $entity_browser_id = $this->getSetting('entity_browser');
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
       $displays[$id] = $definition['label'];
129 129
     }
130 130
 
131
-    $id = Html::getUniqueId('field-' . $this->fieldDefinition->getName() . '-display-settings-wrapper');
131
+    $id = Html::getUniqueId('field-'.$this->fieldDefinition->getName().'-display-settings-wrapper');
132 132
     $element['field_widget_display'] = [
133 133
       '#title' => t('Entity display plugin'),
134 134
       '#type' => 'select',
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
       '#type' => 'fieldset',
145 145
       '#title' => t('Entity display plugin configuration'),
146 146
       '#tree' => TRUE,
147
-      '#prefix' => '<div id="' . $id . '">',
147
+      '#prefix' => '<div id="'.$id.'">',
148 148
       '#suffix' => '</div>',
149 149
     ];
150 150
 
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
       }
219 219
       // Submit was triggered by one of the "Remove" buttons. We need to walk
220 220
       // few levels up to read value of "target_id" element.
221
-      elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], $this->fieldDefinition->getName() . '_remove_') === 0) {
221
+      elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], $this->fieldDefinition->getName().'_remove_') === 0) {
222 222
         $parents = array_merge(array_slice($trigger['#parents'], 0, -4), ['target_id']);
223 223
       }
224 224
 
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
     }
242 242
     $ids = array_filter($ids);
243 243
 
244
-    $hidden_id = Html::getUniqueId('edit-' . $this->fieldDefinition->getName() . '-target-id');
245
-    $details_id = Html::getUniqueId('edit-' . $this->fieldDefinition->getName());
244
+    $hidden_id = Html::getUniqueId('edit-'.$this->fieldDefinition->getName().'-target-id');
245
+    $details_id = Html::getUniqueId('edit-'.$this->fieldDefinition->getName());
246 246
     /** @var \Drupal\entity_browser\EntityBrowserInterface $entity_browser */
247 247
     $entity_browser = $this->entityManager->getStorage('entity_browser')->load($this->getSetting('entity_browser'));
248 248
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
                 'wrapper' => $details_id,
308 308
               ],
309 309
               '#submit' => [[get_class($this), 'removeItemSubmit']],
310
-              '#name' => $this->fieldDefinition->getName() . '_remove_' . $id,
310
+              '#name' => $this->fieldDefinition->getName().'_remove_'.$id,
311 311
               '#limit_validation_errors' => [array_merge($field_parents, [$this->fieldDefinition->getName()])],
312 312
               '#attributes' => ['data-entity-id' => $id],
313 313
             ]
Please login to merge, or discard this patch.
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.
src/Plugin/views/display/EntityBrowser.php 2 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,6 @@
 block discarded – undo
7 7
 
8 8
 namespace Drupal\entity_browser\Plugin\views\display;
9 9
 
10
-use Drupal\Core\DependencyInjection\DependencySerializationTrait;
11 10
 use Drupal\views\Plugin\views\display\DisplayPluginBase;
12 11
 
13 12
 /**
Please login to merge, or discard this 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/Plugin/views/field/SelectForm.php 2 patches
Doc Comments   -4 removed lines patch added patch discarded remove patch
@@ -45,10 +45,6 @@
 block discarded – undo
45 45
   /**
46 46
    * Form constructor for the bulk form.
47 47
    *
48
-   * @param array $form
49
-   *   An associative array containing the structure of the form.
50
-   * @param \Drupal\Core\Form\FormStateInterface $form_state
51
-   *   The current state of the form.
52 48
    */
53 49
   public function viewsForm(&$render) {
54 50
     // Only add the bulk form options and buttons if there are results.
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 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
   /**
Please login to merge, or discard this patch.
src/Entity/EntityBrowser.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -336,7 +336,7 @@
 block discarded – undo
336 336
           '_title_callback' => 'Drupal\entity_browser\Controllers\StandalonePage::title',
337 337
           'entity_browser_id' => $this->id(),
338 338
         ],
339
-        ['_permission' => 'access ' . $this->id() . ' entity browser pages'],
339
+        ['_permission' => 'access '.$this->id().' entity browser pages'],
340 340
         ['_admin_route' => \Drupal::config('node.settings')->get('use_admin_theme')]
341 341
       );
342 342
     }
Please login to merge, or discard this patch.
src/Form/EntityBrowserForm.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@
 block discarded – undo
28 28
    * {@inheritdoc}
29 29
    */
30 30
   public function getFormId() {
31
-    return 'entity_browser_' . $this->entity->id() . '_form';
31
+    return 'entity_browser_'.$this->entity->id().'_form';
32 32
   }
33 33
 
34 34
   /**
Please login to merge, or discard this 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/Permissions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
 
64 64
     foreach ($browsers as $browser) {
65 65
       if ($browser->route()) {
66
-        $permissions['access ' . $browser->id() . ' entity browser pages'] = array(
66
+        $permissions['access '.$browser->id().' entity browser pages'] = array(
67 67
           'title' => $this->translationManager->translate('Access @name pages', array('@name' => $browser->label())),
68 68
           'description' => $this->translationManager->translate('Access pages that %browser uses to operate.', array('%browser' => $browser->label())),
69 69
         );
Please login to merge, or discard this patch.
src/Plugin/EntityBrowser/Display/IFrame.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
             'entity_browser' => [
153 153
               'iframe' => [
154 154
                 $uuid => [
155
-                  'src' => Url::fromRoute('entity_browser.' . $this->configuration['entity_browser_id'], [], [
155
+                  'src' => Url::fromRoute('entity_browser.'.$this->configuration['entity_browser_id'], [], [
156 156
                     'query' => [
157 157
                       'uuid' => $uuid,
158 158
                       'original_path' => $original_path,
@@ -190,13 +190,13 @@  discard block
 block discarded – undo
190 190
   public function propagateSelection(FilterResponseEvent $event) {
191 191
     $render = [
192 192
       'labels' => [
193
-        '#markup' => 'Labels: ' . implode(', ', array_map(function (EntityInterface $item) {return $item->label();}, $this->entities)),
193
+        '#markup' => 'Labels: '.implode(', ', array_map(function(EntityInterface $item) {return $item->label(); }, $this->entities)),
194 194
         '#attached' => [
195 195
           'library' => ['entity_browser/iframe_selection'],
196 196
           'drupalSettings' => [
197 197
             'entity_browser' => [
198 198
               'iframe' => [
199
-                'entities' => array_map(function (EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()];}, $this->entities),
199
+                'entities' => array_map(function(EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; }, $this->entities),
200 200
                 'uuid' => $this->request->query->get('uuid'),
201 201
               ],
202 202
             ],
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
    * {@inheritdoc}
223 223
    */
224 224
   public function path() {
225
-    return '/entity-browser/iframe/' . $this->configuration['entity_browser_id'];
225
+    return '/entity-browser/iframe/'.$this->configuration['entity_browser_id'];
226 226
   }
227 227
 
228 228
 }
Please login to merge, or discard this patch.
src/Plugin/EntityBrowser/SelectionDisplay/View.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@
 block discarded – undo
51 51
     // them only once. Reason for that is how SQL and Views work and we probably
52 52
     // can't do much about it.
53 53
     if (!empty($this->selectedEntities)) {
54
-      $ids = array_map(function(EntityInterface $item) {return $item->id();}, $this->selectedEntities);
54
+      $ids = array_map(function(EntityInterface $item) {return $item->id(); }, $this->selectedEntities);
55 55
       $storage['selection_display_view']->setArguments([implode(',', $ids)]);
56 56
     }
57 57
 
Please login to merge, or discard this patch.