Completed
Pull Request — 8.x-1.x (#151)
by
unknown
02:45
created
src/Plugin/EntityBrowser/Display/Modal.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     // info.
141 141
     $js_event_object = new RegisterJSCallbacks($this->configuration['entity_browser_id'], $uuid);
142 142
     $js_event_object->registerCallback('Drupal.entityBrowser.selectionCompleted');
143
-    $js_event = $this->eventDispatcher->dispatch(Events::REGISTER_JS_CALLBACKS, $js_event_object );
143
+    $js_event = $this->eventDispatcher->dispatch(Events::REGISTER_JS_CALLBACKS, $js_event_object);
144 144
     $original_path = $this->currentPath->getPath();
145 145
     $data = [
146 146
       'query_parameters' => [
@@ -160,21 +160,21 @@  discard block
 block discarded – undo
160 160
       '#theme_wrappers' => ['container'],
161 161
       'path' => [
162 162
         '#type' => 'hidden',
163
-        '#value' => Url::fromRoute('entity_browser.' . $this->configuration['entity_browser_id'], [], $data['query_parameters'])->toString(),
163
+        '#value' => Url::fromRoute('entity_browser.'.$this->configuration['entity_browser_id'], [], $data['query_parameters'])->toString(),
164 164
       ],
165 165
       'open_modal' => [
166 166
         '#type' => 'submit',
167 167
         '#value' => $this->configuration['link_text'],
168 168
         '#limit_validation_errors' => [],
169 169
         '#submit' => [],
170
-        '#name' => Html::getId('op_' . $this->configuration['entity_browser_id'] . '_' . $uuid),
170
+        '#name' => Html::getId('op_'.$this->configuration['entity_browser_id'].'_'.$uuid),
171 171
         '#ajax' => [
172 172
           'callback' => [$this, 'openModal'],
173 173
           'event' => 'click',
174 174
         ],
175 175
         '#attributes' => $data['attributes'],
176 176
         '#attached' => [
177
-          'library' => ['core/drupal.dialog.ajax',  'entity_browser/modal'],
177
+          'library' => ['core/drupal.dialog.ajax', 'entity_browser/modal'],
178 178
           'drupalSettings' => [
179 179
             'entity_browser' => [
180 180
               'modal' => [
@@ -220,13 +220,13 @@  discard block
 block discarded – undo
220 220
         'height' => $this->configuration['height'] - 90,
221 221
         'frameborder' => 0,
222 222
         'style' => 'padding:',
223
-        'name' => 'entity-browser-iframe-' . $element_name
223
+        'name' => 'entity-browser-iframe-'.$element_name
224 224
       ],
225 225
     ];
226 226
     $html = drupal_render($content);
227 227
 
228 228
     $response = new AjaxResponse();
229
-    $response->addCommand(new OpenDialogCommand('#' . $element_name . '-dialog', $this->configuration['link_text'], $html, [
229
+    $response->addCommand(new OpenDialogCommand('#'.$element_name.'-dialog', $this->configuration['link_text'], $html, [
230 230
       'modal' => TRUE,
231 231
       'width' => $this->configuration['width'],
232 232
       'height' => $this->configuration['height'],
@@ -297,7 +297,7 @@  discard block
 block discarded – undo
297 297
    *   An array of ajax commands.
298 298
    */
299 299
   public function getAjaxCommands(FormStateInterface $form_state) {
300
-    $entities = array_map(function(EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()];}, $form_state->get(['entity_browser', 'selected_entities']));
300
+    $entities = array_map(function(EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; }, $form_state->get(['entity_browser', 'selected_entities']));
301 301
 
302 302
     $commands = array();
303 303
     $commands[] = new SelectEntitiesCommand($this->uuid, $entities);
@@ -317,13 +317,13 @@  discard block
 block discarded – undo
317 317
   public function propagateSelection(FilterResponseEvent $event) {
318 318
     $render = [
319 319
       'labels' => [
320
-        '#markup' => 'Labels: ' . implode(', ', array_map(function (EntityInterface $item) {return $item->label();}, $this->entities)),
320
+        '#markup' => 'Labels: '.implode(', ', array_map(function(EntityInterface $item) {return $item->label(); }, $this->entities)),
321 321
         '#attached' => [
322 322
           'library' => ['entity_browser/modal_selection'],
323 323
           'drupalSettings' => [
324 324
             'entity_browser' => [
325 325
               'modal' => [
326
-                'entities' => array_map(function (EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()];}, $this->entities),
326
+                'entities' => array_map(function(EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; }, $this->entities),
327 327
                 'uuid' => $this->request->query->get('uuid'),
328 328
               ],
329 329
             ],
@@ -339,7 +339,7 @@  discard block
 block discarded – undo
339 339
    * {@inheritdoc}
340 340
    */
341 341
   public function path() {
342
-    return '/entity-browser/modal/' . $this->configuration['entity_browser_id'];
342
+    return '/entity-browser/modal/'.$this->configuration['entity_browser_id'];
343 343
   }
344 344
 
345 345
   /**
Please login to merge, or discard this patch.
src/Controllers/EntityBrowserController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -43,7 +43,7 @@
 block discarded – undo
43 43
       // Return the form as a modal dialog.
44 44
       $form['#attached']['library'][] = 'core/drupal.dialog.ajax';
45 45
       $title = $this->t('Edit entity @entity', ['@entity' => $entity->label()]);
46
-      $response = AjaxResponse::create()->addCommand(new OpenDialogCommand('#' . $form['#id'] . '-dialog', $title, $form, ['modal' => TRUE, 'width' => 800]));
46
+      $response = AjaxResponse::create()->addCommand(new OpenDialogCommand('#'.$form['#id'].'-dialog', $title, $form, ['modal' => TRUE, 'width' => 800]));
47 47
       return $response;
48 48
     }
49 49
     else {
Please login to merge, or discard this patch.