@@ -276,7 +276,7 @@ |
||
| 276 | 276 | /** |
| 277 | 277 | * Run widget validators. |
| 278 | 278 | * |
| 279 | - * @param array $entities |
|
| 279 | + * @param \Drupal\Core\Entity\EntityInterface[] $entities |
|
| 280 | 280 | * Array of entity ids to validate. |
| 281 | 281 | * @param array $validators |
| 282 | 282 | * Array of widget validator ids. |
@@ -139,9 +139,9 @@ discard block |
||
| 139 | 139 | $xpath = new \DOMXPath($dom); |
| 140 | 140 | foreach ($commands as $command) { |
| 141 | 141 | if ($command['command'] == 'insert' && $command['method'] == 'replaceWith') { |
| 142 | - $wrapperNode = $xpath->query('//*[@id="' . ltrim($command['selector'], '#') . '"]')->item(0); |
|
| 142 | + $wrapperNode = $xpath->query('//*[@id="'.ltrim($command['selector'], '#').'"]')->item(0); |
|
| 143 | 143 | $newDom = new \DOMDocument(); |
| 144 | - @$newDom->loadHTML('<div>' . $command['data'] . '</div>'); |
|
| 144 | + @$newDom->loadHTML('<div>'.$command['data'].'</div>'); |
|
| 145 | 145 | $newNode = @$dom->importNode($newDom->documentElement->firstChild->firstChild, TRUE); |
| 146 | 146 | $wrapperNode->parentNode->replaceChild($newNode, $wrapperNode); |
| 147 | 147 | $content = $dom->saveHTML(); |
@@ -232,14 +232,14 @@ discard block |
||
| 232 | 232 | $this->assertUrl('/admin/config/content/entity_browser/test_entity_browser/selection_display', ['query' => ['js' => 'nojs']]); |
| 233 | 233 | |
| 234 | 234 | $this->drupalPostForm(NULL, [], 'Next'); |
| 235 | - $this->assertFieldById('edit-table-' . $first_uuid . '-label', 'upload', 'Correct value for widget label found.'); |
|
| 236 | - $this->assertFieldById('edit-table-' . $first_uuid . '-form-upload-location', 'public://', 'Correct value for upload location found.'); |
|
| 237 | - $this->assertFieldByXPath("//input[@data-drupal-selector='edit-table-" . $first_uuid . "-form-submit-text']", 'Select files', 'Correct value for submit text found.'); |
|
| 238 | - $this->assertFieldById('edit-table-' . $second_uuid . '-label', 'entity_form', 'Correct value for widget label found.'); |
|
| 239 | - $this->assertOptionSelectedWithDrupalSelector('edit-table-' . $second_uuid . '-form-entity-type', 'user', 'Correct value for entity type found.'); |
|
| 240 | - $this->assertOptionSelectedWithDrupalSelector('edit-table-' . $second_uuid . '-form-bundle-select', 'user', 'Correct value for bundle found.'); |
|
| 241 | - $this->assertOptionSelectedWithDrupalSelector('edit-table-' . $second_uuid . '-form-form-mode-form-select', 'register', 'Correct value for form modes found.'); |
|
| 242 | - $this->assertFieldByXPath("//input[@data-drupal-selector='edit-table-" . $second_uuid . "-form-submit-text']", 'But some are more equal than others', 'Correct value for submit text found.'); |
|
| 235 | + $this->assertFieldById('edit-table-'.$first_uuid.'-label', 'upload', 'Correct value for widget label found.'); |
|
| 236 | + $this->assertFieldById('edit-table-'.$first_uuid.'-form-upload-location', 'public://', 'Correct value for upload location found.'); |
|
| 237 | + $this->assertFieldByXPath("//input[@data-drupal-selector='edit-table-".$first_uuid."-form-submit-text']", 'Select files', 'Correct value for submit text found.'); |
|
| 238 | + $this->assertFieldById('edit-table-'.$second_uuid.'-label', 'entity_form', 'Correct value for widget label found.'); |
|
| 239 | + $this->assertOptionSelectedWithDrupalSelector('edit-table-'.$second_uuid.'-form-entity-type', 'user', 'Correct value for entity type found.'); |
|
| 240 | + $this->assertOptionSelectedWithDrupalSelector('edit-table-'.$second_uuid.'-form-bundle-select', 'user', 'Correct value for bundle found.'); |
|
| 241 | + $this->assertOptionSelectedWithDrupalSelector('edit-table-'.$second_uuid.'-form-form-mode-form-select', 'register', 'Correct value for form modes found.'); |
|
| 242 | + $this->assertFieldByXPath("//input[@data-drupal-selector='edit-table-".$second_uuid."-form-submit-text']", 'But some are more equal than others', 'Correct value for submit text found.'); |
|
| 243 | 243 | |
| 244 | 244 | $this->drupalPostForm(NULL, [], 'Finish'); |
| 245 | 245 | |
@@ -16,8 +16,8 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | protected function setDatabaseDumpFiles() { |
| 18 | 18 | $this->databaseDumpFiles = [ |
| 19 | - DRUPAL_ROOT . '/core/modules/system/tests/fixtures/update/drupal-8.bare.standard.php.gz', |
|
| 20 | - __DIR__ . '/../../tests/fixtures/update/entity_browser.update-hook-test.php', |
|
| 19 | + DRUPAL_ROOT.'/core/modules/system/tests/fixtures/update/drupal-8.bare.standard.php.gz', |
|
| 20 | + __DIR__.'/../../tests/fixtures/update/entity_browser.update-hook-test.php', |
|
| 21 | 21 | ]; |
| 22 | 22 | } |
| 23 | 23 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | ->get('entity_browser.browser.test_update'); |
| 53 | 53 | |
| 54 | 54 | $this->assertNull($browser->get('submit_text'), 'Old submit text is gone'); |
| 55 | - $this->assertEqual($browser->get('widgets.a4ad947c-9669-497c-9988-24351955a02f.settings.submit_text'), 'All animals are created equal','New submit text appears on the widget.'); |
|
| 55 | + $this->assertEqual($browser->get('widgets.a4ad947c-9669-497c-9988-24351955a02f.settings.submit_text'), 'All animals are created equal', 'New submit text appears on the widget.'); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | } |
@@ -125,7 +125,7 @@ |
||
| 125 | 125 | $files = $this->prepareEntities($form, $form_state); |
| 126 | 126 | array_walk( |
| 127 | 127 | $files, |
| 128 | - function (FileInterface $file) { |
|
| 128 | + function(FileInterface $file) { |
|
| 129 | 129 | $file->setPermanent(); |
| 130 | 130 | $file->save(); |
| 131 | 131 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * {@inheritdoc} |
| 99 | 99 | */ |
| 100 | 100 | public function getForm(array &$original_form, FormStateInterface $form_state, array $aditional_widget_parameters) { |
| 101 | - if (empty($this->configuration['entity_type']) || empty($this->configuration['bundle']) || empty($this->configuration['form_mode'])) { |
|
| 101 | + if (empty($this->configuration['entity_type']) || empty($this->configuration['bundle']) || empty($this->configuration['form_mode'])) { |
|
| 102 | 102 | return ['#markup' => $this->t('The settings for this widget (Entity type, Bundle or Form mode) are not configured correctly.')]; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | // Pretend to be IEFs submit button. |
| 108 | 108 | $form['#submit'] = [['Drupal\inline_entity_form\ElementSubmit', 'trigger']]; |
| 109 | - $form['actions']['submit']['#ief_submit_trigger'] = TRUE; |
|
| 109 | + $form['actions']['submit']['#ief_submit_trigger'] = TRUE; |
|
| 110 | 110 | $form['actions']['submit']['#ief_submit_trigger_all'] = TRUE; |
| 111 | 111 | |
| 112 | 112 | $form['inline_entity_form'] = [ |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | $entities = $this->prepareEntities($form, $form_state); |
| 135 | 135 | array_walk( |
| 136 | 136 | $entities, |
| 137 | - function (EntityInterface $entity) { |
|
| 137 | + function(EntityInterface $entity) { |
|
| 138 | 138 | $entity->save(); |
| 139 | 139 | } |
| 140 | 140 | ); |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $definitions = $this->entityTypeManager->getDefinitions(); |
| 156 | 156 | $entity_types = array_combine( |
| 157 | 157 | array_keys($definitions), |
| 158 | - array_map(function (EntityTypeInterface $item) { |
|
| 158 | + array_map(function(EntityTypeInterface $item) { |
|
| 159 | 159 | return $item->getLabel(); |
| 160 | 160 | }, $definitions) |
| 161 | 161 | ); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | $bundles = []; |
| 174 | 174 | if ($entity_type) { |
| 175 | 175 | $definitions = $this->entityTypeBundleInfo->getBundleInfo($entity_type); |
| 176 | - $bundles = array_map(function ($item) { |
|
| 176 | + $bundles = array_map(function($item) { |
|
| 177 | 177 | return $item['label']; |
| 178 | 178 | }, $definitions); |
| 179 | 179 | } |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | '#options' => $bundles, |
| 187 | 187 | '#default_value' => $bundle, |
| 188 | 188 | ], |
| 189 | - '#attributes' => ['id' => 'bundle-wrapper-' . $this->uuid()], |
|
| 189 | + '#attributes' => ['id' => 'bundle-wrapper-'.$this->uuid()], |
|
| 190 | 190 | ]; |
| 191 | 191 | |
| 192 | 192 | $form['form_mode'] = [ |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | '#default_value' => $form_mode, |
| 198 | 198 | '#options' => $this->entityDisplayRepository->getFormModeOptions($entity_type), |
| 199 | 199 | ], |
| 200 | - '#attributes' => ['id' => 'form-mode-wrapper-' . $this->uuid()], |
|
| 200 | + '#attributes' => ['id' => 'form-mode-wrapper-'.$this->uuid()], |
|
| 201 | 201 | ]; |
| 202 | 202 | |
| 203 | 203 | return $form; |
@@ -222,8 +222,8 @@ discard block |
||
| 222 | 222 | */ |
| 223 | 223 | public function updateFormElements($form, FormStateInterface $form_state) { |
| 224 | 224 | $response = new AjaxResponse(); |
| 225 | - $response->addCommand(new ReplaceCommand('#bundle-wrapper-' . $this->uuid(), $this->updateBundle($form, $form_state))); |
|
| 226 | - $response->addCommand(new ReplaceCommand('#form-mode-wrapper-' . $this->uuid(), $this->updateFormMode($form, $form_state))); |
|
| 225 | + $response->addCommand(new ReplaceCommand('#bundle-wrapper-'.$this->uuid(), $this->updateBundle($form, $form_state))); |
|
| 226 | + $response->addCommand(new ReplaceCommand('#form-mode-wrapper-'.$this->uuid(), $this->updateFormMode($form, $form_state))); |
|
| 227 | 227 | return $response; |
| 228 | 228 | } |
| 229 | 229 | |
@@ -50,7 +50,7 @@ discard block |
||
| 50 | 50 | // can't do much about it. |
| 51 | 51 | $selected_entities = $form_state->get(['entity_browser', 'selected_entities']); |
| 52 | 52 | if (!empty($selected_entities)) { |
| 53 | - $ids = array_map(function (EntityInterface $item) { |
|
| 53 | + $ids = array_map(function(EntityInterface $item) { |
|
| 54 | 54 | return $item->id(); |
| 55 | 55 | }, $selected_entities); |
| 56 | 56 | $storage['selection_display_view']->setArguments([implode(',', $ids)]); |
@@ -86,14 +86,14 @@ discard block |
||
| 86 | 86 | $views = Views::getAllViews(); |
| 87 | 87 | foreach ($views as $view_id => $view) { |
| 88 | 88 | foreach ($view->get('display') as $display_id => $display) { |
| 89 | - $options[$view_id . '.' . $display_id] = $this->t('@view : @display', array('@view' => $view->label(), '@display' => $display['display_title'])); |
|
| 89 | + $options[$view_id.'.'.$display_id] = $this->t('@view : @display', array('@view' => $view->label(), '@display' => $display['display_title'])); |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | $form['view'] = [ |
| 94 | 94 | '#type' => 'select', |
| 95 | 95 | '#title' => $this->t('View : View display'), |
| 96 | - '#default_value' => $this->configuration['view'] . '.' . $this->configuration['view_display'], |
|
| 96 | + '#default_value' => $this->configuration['view'].'.'.$this->configuration['view_display'], |
|
| 97 | 97 | '#options' => $options, |
| 98 | 98 | '#required' => TRUE, |
| 99 | 99 | '#description' => $this->t('View display to use for displaying currently selected items. Do note that to get something usefull out of this display, its first contextual filter should be a filter on the primary identifier field of your entity type (e.g., Node ID, Media ID).'), |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | $display = ['#markup' => $display]; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - $form['selected']['items_' . $entity->id() . '_' . $id] = [ |
|
| 105 | + $form['selected']['items_'.$entity->id().'_'.$id] = [ |
|
| 106 | 106 | '#theme_wrappers' => ['container'], |
| 107 | 107 | '#attributes' => [ |
| 108 | 108 | 'class' => ['item-container'], |
@@ -113,10 +113,10 @@ discard block |
||
| 113 | 113 | '#type' => 'submit', |
| 114 | 114 | '#value' => $this->t('Remove'), |
| 115 | 115 | '#submit' => [[get_class($this), 'removeItemSubmit']], |
| 116 | - '#name' => 'remove_' . $entity->id() . '_' . $id, |
|
| 116 | + '#name' => 'remove_'.$entity->id().'_'.$id, |
|
| 117 | 117 | '#attributes' => [ |
| 118 | 118 | 'data-row-id' => $id, |
| 119 | - 'data-remove-entity' => 'items_' . $entity->id(), |
|
| 119 | + 'data-remove-entity' => 'items_'.$entity->id(), |
|
| 120 | 120 | ], |
| 121 | 121 | ], |
| 122 | 122 | 'weight' => [ |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | // Remove weight of entity being removed. |
| 159 | 159 | $form_state->unsetValue([ |
| 160 | 160 | 'selected', |
| 161 | - $triggering_element['#attributes']['data-remove-entity'] . '_' . $triggering_element['#attributes']['data-row-id'], |
|
| 161 | + $triggering_element['#attributes']['data-remove-entity'].'_'.$triggering_element['#attributes']['data-row-id'], |
|
| 162 | 162 | ]); |
| 163 | 163 | |
| 164 | 164 | // Remove entity itself. |
@@ -453,8 +453,7 @@ discard block |
||
| 453 | 453 | // and use this information to return correct part of the form. |
| 454 | 454 | if (!empty($trigger['#ajax']['event']) && $trigger['#ajax']['event'] == 'entity_browser_value_updated') { |
| 455 | 455 | $parents = array_slice($trigger['#array_parents'], 0, -1); |
| 456 | - } |
|
| 457 | - elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], '_remove_')) { |
|
| 456 | + } elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], '_remove_')) { |
|
| 458 | 457 | $parents = array_slice($trigger['#array_parents'], 0, -static::$deleteDepth); |
| 459 | 458 | } |
| 460 | 459 | |
@@ -621,12 +620,10 @@ discard block |
||
| 621 | 620 | $entity_browser_id = $this->getSetting('entity_browser'); |
| 622 | 621 | if (empty($entity_browser_id)) { |
| 623 | 622 | return [$this->t('No entity browser selected.')]; |
| 624 | - } |
|
| 625 | - else { |
|
| 623 | + } else { |
|
| 626 | 624 | if ($browser = $this->entityTypeManager->getStorage('entity_browser')->load($entity_browser_id)) { |
| 627 | 625 | $summary[] = $this->t('Entity browser: @browser', ['@browser' => $browser->label()]); |
| 628 | - } |
|
| 629 | - else { |
|
| 626 | + } else { |
|
| 630 | 627 | drupal_set_message($this->t('Missing entity browser!'), 'error'); |
| 631 | 628 | return [$this->t('Missing entity browser!')]; |
| 632 | 629 | } |
@@ -636,8 +633,7 @@ discard block |
||
| 636 | 633 | $selection_mode_options = EntityBrowserElement::getSelectionModeOptions(); |
| 637 | 634 | if (isset($selection_mode_options[$selection_mode])) { |
| 638 | 635 | $summary[] = $this->t('Selection mode: @selection_mode', ['@selection_mode' => $selection_mode_options[$selection_mode]]); |
| 639 | - } |
|
| 640 | - else { |
|
| 636 | + } else { |
|
| 641 | 637 | $summary[] = $this->t('Undefined selection mode.'); |
| 642 | 638 | } |
| 643 | 639 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | } |
| 147 | 147 | } |
| 148 | 148 | |
| 149 | - $id = Html::getUniqueId('field-' . $this->fieldDefinition->getName() . '-display-settings-wrapper'); |
|
| 149 | + $id = Html::getUniqueId('field-'.$this->fieldDefinition->getName().'-display-settings-wrapper'); |
|
| 150 | 150 | $element['field_widget_display'] = [ |
| 151 | 151 | '#title' => $this->t('Entity display plugin'), |
| 152 | 152 | '#type' => 'select', |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | '#type' => 'fieldset', |
| 190 | 190 | '#title' => $this->t('Entity display plugin configuration'), |
| 191 | 191 | '#tree' => TRUE, |
| 192 | - '#prefix' => '<div id="' . $id . '">', |
|
| 192 | + '#prefix' => '<div id="'.$id.'">', |
|
| 193 | 193 | '#suffix' => '</div>', |
| 194 | 194 | ]; |
| 195 | 195 | |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * A key for form state storage. |
| 273 | 273 | */ |
| 274 | 274 | protected function getFormStateKey(FieldItemListInterface $items) { |
| 275 | - return $items->getEntity()->uuid() . ':' . $items->getFieldDefinition()->getName(); |
|
| 275 | + return $items->getEntity()->uuid().':'.$items->getFieldDefinition()->getName(); |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | /** |
@@ -284,7 +284,7 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | // Get correct ordered list of entity IDs. |
| 286 | 286 | $ids = array_map( |
| 287 | - function (EntityInterface $entity) { |
|
| 287 | + function(EntityInterface $entity) { |
|
| 288 | 288 | return $entity->id(); |
| 289 | 289 | }, |
| 290 | 290 | $entities |
@@ -298,8 +298,8 @@ discard block |
||
| 298 | 298 | // might result in unpredictable results. |
| 299 | 299 | $form_state->set(['entity_browser_widget', $this->getFormStateKey($items)], $ids); |
| 300 | 300 | |
| 301 | - $hidden_id = Html::getUniqueId('edit-' . $this->fieldDefinition->getName() . '-target-id'); |
|
| 302 | - $details_id = Html::getUniqueId('edit-' . $this->fieldDefinition->getName()); |
|
| 301 | + $hidden_id = Html::getUniqueId('edit-'.$this->fieldDefinition->getName().'-target-id'); |
|
| 302 | + $details_id = Html::getUniqueId('edit-'.$this->fieldDefinition->getName()); |
|
| 303 | 303 | |
| 304 | 304 | $element += [ |
| 305 | 305 | '#id' => $details_id, |
@@ -314,8 +314,8 @@ discard block |
||
| 314 | 314 | // We need to repeat ID here as it is otherwise skipped when rendering. |
| 315 | 315 | '#attributes' => ['id' => $hidden_id], |
| 316 | 316 | '#default_value' => implode(' ', array_map( |
| 317 | - function (EntityInterface $item) { |
|
| 318 | - return $item->getEntityTypeId() . ':' . $item->id(); |
|
| 317 | + function(EntityInterface $item) { |
|
| 318 | + return $item->getEntityTypeId().':'.$item->id(); |
|
| 319 | 319 | }, |
| 320 | 320 | $entities |
| 321 | 321 | )), |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | */ |
| 365 | 365 | public static function processEntityBrowser(&$element, FormStateInterface $form_state, &$complete_form) { |
| 366 | 366 | $uuid = key($element['#attached']['drupalSettings']['entity_browser']); |
| 367 | - $element['#attached']['drupalSettings']['entity_browser'][$uuid]['selector'] = '#' . $element['#custom_hidden_id']; |
|
| 367 | + $element['#attached']['drupalSettings']['entity_browser'][$uuid]['selector'] = '#'.$element['#custom_hidden_id']; |
|
| 368 | 368 | return $element; |
| 369 | 369 | } |
| 370 | 370 | |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | '#theme_wrappers' => ['container'], |
| 470 | 470 | '#attributes' => ['class' => ['entities-list']], |
| 471 | 471 | 'items' => array_map( |
| 472 | - function (ContentEntityInterface $entity, $row_id) use ($field_widget_display, $details_id, $field_parents) { |
|
| 472 | + function(ContentEntityInterface $entity, $row_id) use ($field_widget_display, $details_id, $field_parents) { |
|
| 473 | 473 | $display = $field_widget_display->view($entity); |
| 474 | 474 | if (is_string($display)) { |
| 475 | 475 | $display = ['#markup' => $display]; |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | '#theme_wrappers' => ['container'], |
| 479 | 479 | '#attributes' => [ |
| 480 | 480 | 'class' => ['item-container', Html::getClass($field_widget_display->getPluginId())], |
| 481 | - 'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity->id(), |
|
| 481 | + 'data-entity-id' => $entity->getEntityTypeId().':'.$entity->id(), |
|
| 482 | 482 | 'data-row-id' => $row_id, |
| 483 | 483 | ], |
| 484 | 484 | 'display' => $display, |
@@ -490,10 +490,10 @@ discard block |
||
| 490 | 490 | 'wrapper' => $details_id, |
| 491 | 491 | ], |
| 492 | 492 | '#submit' => [[get_class($this), 'removeItemSubmit']], |
| 493 | - '#name' => $this->fieldDefinition->getName() . '_remove_' . $entity->id() . '_' . $row_id . '_' . md5(json_encode($field_parents)), |
|
| 493 | + '#name' => $this->fieldDefinition->getName().'_remove_'.$entity->id().'_'.$row_id.'_'.md5(json_encode($field_parents)), |
|
| 494 | 494 | '#limit_validation_errors' => [array_merge($field_parents, [$this->fieldDefinition->getName()])], |
| 495 | 495 | '#attributes' => [ |
| 496 | - 'data-entity-id' => $entity->getEntityTypeId() . ':' . $entity->id(), |
|
| 496 | + 'data-entity-id' => $entity->getEntityTypeId().':'.$entity->id(), |
|
| 497 | 497 | 'data-row-id' => $row_id, |
| 498 | 498 | ], |
| 499 | 499 | '#access' => (bool) $this->getSetting('field_widget_remove'), |
@@ -631,7 +631,7 @@ discard block |
||
| 631 | 631 | } |
| 632 | 632 | // Submit was triggered by one of the "Remove" buttons. We need to walk |
| 633 | 633 | // few levels up to read value of "target_id" element. |
| 634 | - elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], $this->fieldDefinition->getName() . '_remove_') === 0) { |
|
| 634 | + elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], $this->fieldDefinition->getName().'_remove_') === 0) { |
|
| 635 | 635 | $parents = array_merge(array_slice($trigger['#parents'], 0, -static::$deleteDepth), ['target_id']); |
| 636 | 636 | } |
| 637 | 637 | |
@@ -688,7 +688,7 @@ discard block |
||
| 688 | 688 | // If an entity browser is being used in this widget, add it as a config |
| 689 | 689 | // dependency. |
| 690 | 690 | if ($browser_name = $this->getSetting('entity_browser')) { |
| 691 | - $dependencies['config'][] = 'entity_browser.browser.' . $browser_name; |
|
| 691 | + $dependencies['config'][] = 'entity_browser.browser.'.$browser_name; |
|
| 692 | 692 | } |
| 693 | 693 | |
| 694 | 694 | return $dependencies; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | '#theme_wrappers' => ['container'], |
| 144 | 144 | 'path' => [ |
| 145 | 145 | '#type' => 'hidden', |
| 146 | - '#value' => Url::fromRoute('entity_browser.' . $this->configuration['entity_browser_id'], [], $data['query_parameters'])->toString(), |
|
| 146 | + '#value' => Url::fromRoute('entity_browser.'.$this->configuration['entity_browser_id'], [], $data['query_parameters'])->toString(), |
|
| 147 | 147 | ], |
| 148 | 148 | 'open_modal' => [ |
| 149 | 149 | '#type' => 'submit', |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | $field_name = $triggering_element['#parents'][0]; |
| 198 | 198 | $element_name = $this->configuration['entity_browser_id']; |
| 199 | - $name = 'entity_browser_iframe_' . $element_name; |
|
| 199 | + $name = 'entity_browser_iframe_'.$element_name; |
|
| 200 | 200 | $content = [ |
| 201 | 201 | '#type' => 'html_tag', |
| 202 | 202 | '#tag' => 'iframe', |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | $html = drupal_render($content); |
| 215 | 215 | |
| 216 | 216 | $response = new AjaxResponse(); |
| 217 | - $response->addCommand(new OpenDialogCommand('#' . Html::getUniqueId($field_name . '-' . $element_name . '-dialog'), $this->configuration['link_text'], $html, [ |
|
| 217 | + $response->addCommand(new OpenDialogCommand('#'.Html::getUniqueId($field_name.'-'.$element_name.'-dialog'), $this->configuration['link_text'], $html, [ |
|
| 218 | 218 | 'width' => 'auto', |
| 219 | 219 | 'height' => 'auto', |
| 220 | 220 | 'modal' => TRUE, |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | public function propagateSelection(FilterResponseEvent $event) { |
| 305 | 305 | $render = [ |
| 306 | 306 | 'labels' => [ |
| 307 | - '#markup' => 'Labels: ' . implode(', ', array_map(function (EntityInterface $item) { |
|
| 307 | + '#markup' => 'Labels: '.implode(', ', array_map(function(EntityInterface $item) { |
|
| 308 | 308 | return $item->label(); |
| 309 | 309 | }, $this->entities)), |
| 310 | 310 | '#attached' => [ |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | 'drupalSettings' => [ |
| 313 | 313 | 'entity_browser' => [ |
| 314 | 314 | 'modal' => [ |
| 315 | - 'entities' => array_map(function (EntityInterface $item) { |
|
| 315 | + 'entities' => array_map(function(EntityInterface $item) { |
|
| 316 | 316 | return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; |
| 317 | 317 | }, $this->entities), |
| 318 | 318 | 'uuid' => $this->request->query->get('uuid'), |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | * {@inheritdoc} |
| 331 | 331 | */ |
| 332 | 332 | public function path() { |
| 333 | - return '/entity-browser/modal/' . $this->configuration['entity_browser_id']; |
|
| 333 | + return '/entity-browser/modal/'.$this->configuration['entity_browser_id']; |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | /** |