@@ -43,12 +43,12 @@ |
||
| 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('#' . $entity->getEntityTypeId() . '-' . $entity->id() . '-edit-dialog', $title, $form, ['modal' => TRUE, 'width' => 800])); |
|
| 46 | + $response = AjaxResponse::create()->addCommand(new OpenDialogCommand('#'.$entity->getEntityTypeId().'-'.$entity->id().'-edit-dialog', $title, $form, ['modal' => TRUE, 'width' => 800])); |
|
| 47 | 47 | return $response; |
| 48 | 48 | } |
| 49 | 49 | else { |
| 50 | 50 | // Return command for closing the modal. |
| 51 | - return AjaxResponse::create()->addCommand(new CloseDialogCommand('#' . $entity->getEntityTypeId() . '-' . $entity->id() . '-edit-dialog')); |
|
| 51 | + return AjaxResponse::create()->addCommand(new CloseDialogCommand('#'.$entity->getEntityTypeId().'-'.$entity->id().'-edit-dialog')); |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
@@ -119,7 +119,7 @@ discard block |
||
| 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 |
||
| 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' => [ |
@@ -200,13 +200,13 @@ discard block |
||
| 200 | 200 | 'height' => $this->configuration['height'] - 90, |
| 201 | 201 | 'frameborder' => 0, |
| 202 | 202 | 'style' => 'padding:0', |
| 203 | - 'name' => 'entity-browser-iframe-' . Html::cleanCssIdentifier($element_name) |
|
| 203 | + 'name' => 'entity-browser-iframe-'.Html::cleanCssIdentifier($element_name) |
|
| 204 | 204 | ], |
| 205 | 205 | ]; |
| 206 | 206 | $html = drupal_render($content); |
| 207 | 207 | |
| 208 | 208 | $response = new AjaxResponse(); |
| 209 | - $response->addCommand(new OpenDialogCommand('#' . Html::getUniqueId($field_name . '-' . $element_name . '-dialog'), $this->configuration['link_text'], $html, [ |
|
| 209 | + $response->addCommand(new OpenDialogCommand('#'.Html::getUniqueId($field_name.'-'.$element_name.'-dialog'), $this->configuration['link_text'], $html, [ |
|
| 210 | 210 | 'width' => 'auto', |
| 211 | 211 | 'height' => 'auto', |
| 212 | 212 | 'modal' => TRUE, |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * An array of ajax commands. |
| 283 | 283 | */ |
| 284 | 284 | public function getAjaxCommands(FormStateInterface $form_state) { |
| 285 | - $entities = array_map(function(EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()];}, $form_state->get(['entity_browser', 'selected_entities'])); |
|
| 285 | + $entities = array_map(function(EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; }, $form_state->get(['entity_browser', 'selected_entities'])); |
|
| 286 | 286 | |
| 287 | 287 | $commands = []; |
| 288 | 288 | $commands[] = new SelectEntitiesCommand($this->uuid, $entities); |
@@ -302,13 +302,13 @@ discard block |
||
| 302 | 302 | public function propagateSelection(FilterResponseEvent $event) { |
| 303 | 303 | $render = [ |
| 304 | 304 | 'labels' => [ |
| 305 | - '#markup' => 'Labels: ' . implode(', ', array_map(function (EntityInterface $item) {return $item->label();}, $this->entities)), |
|
| 305 | + '#markup' => 'Labels: '.implode(', ', array_map(function(EntityInterface $item) {return $item->label(); }, $this->entities)), |
|
| 306 | 306 | '#attached' => [ |
| 307 | 307 | 'library' => ['entity_browser/modal_selection'], |
| 308 | 308 | 'drupalSettings' => [ |
| 309 | 309 | 'entity_browser' => [ |
| 310 | 310 | 'modal' => [ |
| 311 | - 'entities' => array_map(function (EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()];}, $this->entities), |
|
| 311 | + 'entities' => array_map(function(EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; }, $this->entities), |
|
| 312 | 312 | 'uuid' => $this->request->query->get('uuid'), |
| 313 | 313 | ], |
| 314 | 314 | ], |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | * {@inheritdoc} |
| 325 | 325 | */ |
| 326 | 326 | public function path() { |
| 327 | - return '/entity-browser/modal/' . $this->configuration['entity_browser_id']; |
|
| 327 | + return '/entity-browser/modal/'.$this->configuration['entity_browser_id']; |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | /** |