Completed
Push — 8.x-1.x ( f7c112...e3b4ed )
by Janez
02:27
created
src/Plugin/EntityBrowser/Display/Modal.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
     $uuid = $this->getUuid();
120 120
     $js_event_object = new RegisterJSCallbacks($this->configuration['entity_browser_id'], $uuid);
121 121
     $js_event_object->registerCallback('Drupal.entityBrowser.selectionCompleted');
122
-    $js_event = $this->eventDispatcher->dispatch(Events::REGISTER_JS_CALLBACKS, $js_event_object );
122
+    $js_event = $this->eventDispatcher->dispatch(Events::REGISTER_JS_CALLBACKS, $js_event_object);
123 123
     $original_path = $this->currentPath->getPath();
124 124
     $data = [
125 125
       'query_parameters' => [
@@ -139,21 +139,21 @@  discard block
 block discarded – undo
139 139
       '#theme_wrappers' => ['container'],
140 140
       'path' => [
141 141
         '#type' => 'hidden',
142
-        '#value' => Url::fromRoute('entity_browser.' . $this->configuration['entity_browser_id'], [], $data['query_parameters'])->toString(),
142
+        '#value' => Url::fromRoute('entity_browser.'.$this->configuration['entity_browser_id'], [], $data['query_parameters'])->toString(),
143 143
       ],
144 144
       'open_modal' => [
145 145
         '#type' => 'submit',
146 146
         '#value' => $this->configuration['link_text'],
147 147
         '#limit_validation_errors' => [],
148 148
         '#submit' => [],
149
-        '#name' => Html::getId('op_' . $this->configuration['entity_browser_id'] . '_' . $uuid),
149
+        '#name' => Html::getId('op_'.$this->configuration['entity_browser_id'].'_'.$uuid),
150 150
         '#ajax' => [
151 151
           'callback' => [$this, 'openModal'],
152 152
           'event' => 'click',
153 153
         ],
154 154
         '#attributes' => $data['attributes'],
155 155
         '#attached' => [
156
-          'library' => ['core/drupal.dialog.ajax',  'entity_browser/modal'],
156
+          'library' => ['core/drupal.dialog.ajax', 'entity_browser/modal'],
157 157
           'drupalSettings' => [
158 158
             'entity_browser' => [
159 159
               'modal' => [
@@ -201,13 +201,13 @@  discard block
 block discarded – undo
201 201
         'height' => $this->configuration['height'] - 90,
202 202
         'frameborder' => 0,
203 203
         'style' => 'padding:0',
204
-        'name' => 'entity_browser_iframe_' . Html::cleanCssIdentifier($element_name)
204
+        'name' => 'entity_browser_iframe_'.Html::cleanCssIdentifier($element_name)
205 205
       ],
206 206
     ];
207 207
     $html = drupal_render($content);
208 208
 
209 209
     $response = new AjaxResponse();
210
-    $response->addCommand(new OpenDialogCommand('#' . Html::getUniqueId($field_name . '-' . $element_name . '-dialog'), $this->configuration['link_text'], $html, [
210
+    $response->addCommand(new OpenDialogCommand('#'.Html::getUniqueId($field_name.'-'.$element_name.'-dialog'), $this->configuration['link_text'], $html, [
211 211
       'width' => 'auto',
212 212
       'height' => 'auto',
213 213
       'modal' => TRUE,
@@ -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 = [];
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.