Completed
Push — 8.x-1.x ( 4eb492...a2fddb )
by Janez
05:45
created
src/Plugin/Field/FieldWidget/EntityReference.php 1 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.
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/Plugin/EntityBrowser/Display/Modal.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -138,13 +138,13 @@  discard block
 block discarded – undo
138 138
     // info.
139 139
     $event_object = new RegisterJSCallbacks($this->configuration['entity_browser_id'], $uuid);
140 140
     $event_object->registerCallback('Drupal.entityBrowser.selectionCompleted');
141
-    $event = $this->eventDispatcher->dispatch(Events::REGISTER_JS_CALLBACKS, $event_object );
141
+    $event = $this->eventDispatcher->dispatch(Events::REGISTER_JS_CALLBACKS, $event_object);
142 142
     $original_path = $this->currentPath->getPath();
143 143
     return [
144 144
       '#theme_wrappers' => ['container'],
145 145
       'path' => [
146 146
         '#type' => 'hidden',
147
-        '#value' => Url::fromRoute('entity_browser.' . $this->configuration['entity_browser_id'], [], [
147
+        '#value' => Url::fromRoute('entity_browser.'.$this->configuration['entity_browser_id'], [], [
148 148
           'query' => [
149 149
             'uuid' => $uuid,
150 150
             'original_path' => $original_path,
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
         '#value' => $this->configuration['link_text'],
157 157
         '#limit_validation_errors' => [],
158 158
         '#submit' => [],
159
-        '#name' => 'op_' . $this->configuration['entity_browser_id'],
159
+        '#name' => 'op_'.$this->configuration['entity_browser_id'],
160 160
         '#ajax' => [
161 161
           'callback' => [$this, 'openModal'],
162 162
           'event' => 'click',
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
           'data-uuid' => $uuid,
166 166
         ],
167 167
         '#attached' => [
168
-          'library' => ['core/drupal.dialog.ajax',  'entity_browser/modal'],
168
+          'library' => ['core/drupal.dialog.ajax', 'entity_browser/modal'],
169 169
           'drupalSettings' => [
170 170
             'entity_browser' => [
171 171
               'modal' => [
@@ -285,7 +285,7 @@  discard block
 block discarded – undo
285 285
    *   An array of ajax commands.
286 286
    */
287 287
   public function getAjaxCommands(FormStateInterface $form_state) {
288
-    $entities = array_map(function(EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()];}, $form_state->get(['entity_browser', 'selected_entities']));
288
+    $entities = array_map(function(EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; }, $form_state->get(['entity_browser', 'selected_entities']));
289 289
 
290 290
     $commands = array();
291 291
     $commands[] = new SelectEntitiesCommand($this->uuid, $entities);
@@ -305,13 +305,13 @@  discard block
 block discarded – undo
305 305
   public function propagateSelection(FilterResponseEvent $event) {
306 306
     $render = [
307 307
       'labels' => [
308
-        '#markup' => 'Labels: ' . implode(', ', array_map(function (EntityInterface $item) {return $item->label();}, $this->entities)),
308
+        '#markup' => 'Labels: '.implode(', ', array_map(function(EntityInterface $item) {return $item->label(); }, $this->entities)),
309 309
         '#attached' => [
310 310
           'library' => ['entity_browser/modal_selection'],
311 311
           'drupalSettings' => [
312 312
             'entity_browser' => [
313 313
               'modal' => [
314
-                'entities' => array_map(function (EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()];}, $this->entities),
314
+                'entities' => array_map(function(EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; }, $this->entities),
315 315
                 'uuid' => $this->request->query->get('uuid'),
316 316
               ],
317 317
             ],
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
    * {@inheritdoc}
328 328
    */
329 329
   public function path() {
330
-    return '/entity-browser/modal/' . $this->configuration['entity_browser_id'];
330
+    return '/entity-browser/modal/'.$this->configuration['entity_browser_id'];
331 331
   }
332 332
 
333 333
   /**
Please login to merge, or discard this patch.