@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | $display = ['#markup' => $display]; |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $form['selected']['items_' . $entity->id()] = [ |
|
| 100 | + $form['selected']['items_'.$entity->id()] = [ |
|
| 101 | 101 | '#theme_wrappers' => ['container'], |
| 102 | 102 | '#attributes' => [ |
| 103 | 103 | 'class' => ['item-container'], |
@@ -108,10 +108,10 @@ discard block |
||
| 108 | 108 | '#type' => 'submit', |
| 109 | 109 | '#value' => $this->t('Remove'), |
| 110 | 110 | '#submit' => [[get_class($this), 'removeItemSubmit']], |
| 111 | - '#name' => 'remove_' . $entity->id(), |
|
| 111 | + '#name' => 'remove_'.$entity->id(), |
|
| 112 | 112 | '#attributes' => [ |
| 113 | 113 | 'data-row-id' => $id, |
| 114 | - 'data-remove-entity' => 'items_' . $entity->id(), |
|
| 114 | + 'data-remove-entity' => 'items_'.$entity->id(), |
|
| 115 | 115 | ], |
| 116 | 116 | ], |
| 117 | 117 | 'weight' => [ |
@@ -84,14 +84,14 @@ |
||
| 84 | 84 | $views = Views::getAllViews(); |
| 85 | 85 | foreach ($views as $view_id => $view) { |
| 86 | 86 | foreach ($view->get('display') as $display_id => $display) { |
| 87 | - $options[$view_id . '.' . $display_id] = $this->t('@view : @display', array('@view' => $view->label(), '@display' => $display['display_title'])); |
|
| 87 | + $options[$view_id.'.'.$display_id] = $this->t('@view : @display', array('@view' => $view->label(), '@display' => $display['display_title'])); |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | $form['view'] = [ |
| 92 | 92 | '#type' => 'select', |
| 93 | 93 | '#title' => $this->t('View : View display'), |
| 94 | - '#default_value' => $this->configuration['view'] . '.' . $this->configuration['view_display'], |
|
| 94 | + '#default_value' => $this->configuration['view'].'.'.$this->configuration['view_display'], |
|
| 95 | 95 | '#options' => $options, |
| 96 | 96 | '#required' => TRUE, |
| 97 | 97 | '#description' => '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).', |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | 'entity_browser' => [ |
| 149 | 149 | 'iframe' => [ |
| 150 | 150 | $uuid => [ |
| 151 | - 'src' => Url::fromRoute('entity_browser.' . $this->configuration['entity_browser_id'], [], $data['query_parameters']) |
|
| 151 | + 'src' => Url::fromRoute('entity_browser.'.$this->configuration['entity_browser_id'], [], $data['query_parameters']) |
|
| 152 | 152 | ->toString(), |
| 153 | 153 | 'width' => $this->configuration['width'], |
| 154 | 154 | 'height' => $this->configuration['height'], |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | public function propagateSelection(FilterResponseEvent $event) { |
| 183 | 183 | $render = [ |
| 184 | 184 | 'labels' => [ |
| 185 | - '#markup' => 'Labels: ' . implode(', ', array_map(function (EntityInterface $item) { |
|
| 185 | + '#markup' => 'Labels: '.implode(', ', array_map(function(EntityInterface $item) { |
|
| 186 | 186 | return $item->label(); |
| 187 | 187 | }, $this->entities)), |
| 188 | 188 | '#attached' => [ |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | 'drupalSettings' => [ |
| 191 | 191 | 'entity_browser' => [ |
| 192 | 192 | 'iframe' => [ |
| 193 | - 'entities' => array_map(function (EntityInterface $item) { |
|
| 193 | + 'entities' => array_map(function(EntityInterface $item) { |
|
| 194 | 194 | return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; |
| 195 | 195 | }, $this->entities), |
| 196 | 196 | 'uuid' => $this->request->query->get('uuid'), |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | * {@inheritdoc} |
| 209 | 209 | */ |
| 210 | 210 | public function path() { |
| 211 | - return '/entity-browser/iframe/' . $this->configuration['entity_browser_id']; |
|
| 211 | + return '/entity-browser/iframe/'.$this->configuration['entity_browser_id']; |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | /** |
@@ -137,9 +137,9 @@ discard block |
||
| 137 | 137 | $xpath = new \DOMXPath($dom); |
| 138 | 138 | foreach ($commands as $command) { |
| 139 | 139 | if ($command['command'] == 'insert' && $command['method'] == 'replaceWith') { |
| 140 | - $wrapperNode = $xpath->query('//*[@id="' . ltrim($command['selector'], '#') . '"]')->item(0); |
|
| 140 | + $wrapperNode = $xpath->query('//*[@id="'.ltrim($command['selector'], '#').'"]')->item(0); |
|
| 141 | 141 | $newDom = new \DOMDocument(); |
| 142 | - @$newDom->loadHTML('<div>' . $command['data'] . '</div>'); |
|
| 142 | + @$newDom->loadHTML('<div>'.$command['data'].'</div>'); |
|
| 143 | 143 | $newNode = @$dom->importNode($newDom->documentElement->firstChild->firstChild, TRUE); |
| 144 | 144 | $wrapperNode->parentNode->replaceChild($newNode, $wrapperNode); |
| 145 | 145 | $content = $dom->saveHTML(); |
@@ -228,12 +228,12 @@ discard block |
||
| 228 | 228 | $this->assertUrl('/admin/config/content/entity_browser/test_entity_browser/selection_display', ['query' => ['js' => 'nojs']]); |
| 229 | 229 | |
| 230 | 230 | $this->drupalPostForm(NULL, [], 'Next'); |
| 231 | - $this->assertFieldById('edit-table-' . $first_uuid . '-label', 'upload', 'Correct value for widget label found.'); |
|
| 232 | - $this->assertFieldById('edit-table-' . $first_uuid . '-form-upload-location', 'public://', 'Correct value for upload location found.'); |
|
| 233 | - $this->assertFieldById('edit-table-' . $second_uuid . '-label', 'entity_form', 'Correct value for widget label found.'); |
|
| 234 | - $this->assertOptionSelectedWithDrupalSelector('edit-table-' . $second_uuid . '-form-entity-type', 'user', 'Correct value for entity type found.'); |
|
| 235 | - $this->assertOptionSelectedWithDrupalSelector('edit-table-' . $second_uuid . '-form-bundle-select', 'user', 'Correct value for bundle found.'); |
|
| 236 | - $this->assertOptionSelectedWithDrupalSelector('edit-table-' . $second_uuid . '-form-form-mode-form-select', 'register', 'Correct value for form modes found.'); |
|
| 231 | + $this->assertFieldById('edit-table-'.$first_uuid.'-label', 'upload', 'Correct value for widget label found.'); |
|
| 232 | + $this->assertFieldById('edit-table-'.$first_uuid.'-form-upload-location', 'public://', 'Correct value for upload location found.'); |
|
| 233 | + $this->assertFieldById('edit-table-'.$second_uuid.'-label', 'entity_form', 'Correct value for widget label found.'); |
|
| 234 | + $this->assertOptionSelectedWithDrupalSelector('edit-table-'.$second_uuid.'-form-entity-type', 'user', 'Correct value for entity type found.'); |
|
| 235 | + $this->assertOptionSelectedWithDrupalSelector('edit-table-'.$second_uuid.'-form-bundle-select', 'user', 'Correct value for bundle found.'); |
|
| 236 | + $this->assertOptionSelectedWithDrupalSelector('edit-table-'.$second_uuid.'-form-form-mode-form-select', 'register', 'Correct value for form modes found.'); |
|
| 237 | 237 | |
| 238 | 238 | $this->drupalPostForm(NULL, [], 'Finish'); |
| 239 | 239 | |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * {@inheritdoc} |
| 97 | 97 | */ |
| 98 | 98 | public function getForm(array &$original_form, FormStateInterface $form_state, array $aditional_widget_parameters) { |
| 99 | - if (empty($this->configuration['entity_type']) || empty($this->configuration['bundle']) || empty($this->configuration['form_mode'])) { |
|
| 99 | + if (empty($this->configuration['entity_type']) || empty($this->configuration['bundle']) || empty($this->configuration['form_mode'])) { |
|
| 100 | 100 | return ['#markup' => t('The settings for this widget (Entity type, Bundle or Form mode) are not configured correctly.')]; |
| 101 | 101 | } |
| 102 | 102 | |
@@ -137,7 +137,7 @@ discard block |
||
| 137 | 137 | $definitions = $this->entityTypeManager->getDefinitions(); |
| 138 | 138 | $entity_types = array_combine( |
| 139 | 139 | array_keys($definitions), |
| 140 | - array_map(function (EntityTypeInterface $item) { |
|
| 140 | + array_map(function(EntityTypeInterface $item) { |
|
| 141 | 141 | return $item->getLabel(); |
| 142 | 142 | }, $definitions) |
| 143 | 143 | ); |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | $bundles = []; |
| 156 | 156 | if ($entity_type) { |
| 157 | 157 | $definitions = $this->entityTypeBundleInfo->getBundleInfo($entity_type); |
| 158 | - $bundles = array_map(function ($item) { |
|
| 158 | + $bundles = array_map(function($item) { |
|
| 159 | 159 | return $item['label']; |
| 160 | 160 | }, $definitions); |
| 161 | 161 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | '#options' => $bundles, |
| 169 | 169 | '#default_value' => $bundle, |
| 170 | 170 | ], |
| 171 | - '#attributes' => ['id' => 'bundle-wrapper-' . $this->uuid()], |
|
| 171 | + '#attributes' => ['id' => 'bundle-wrapper-'.$this->uuid()], |
|
| 172 | 172 | ]; |
| 173 | 173 | |
| 174 | 174 | $form['form_mode'] = [ |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | '#default_value' => $form_mode, |
| 180 | 180 | '#options' => $this->entityDisplayRepository->getFormModeOptions($entity_type), |
| 181 | 181 | ], |
| 182 | - '#attributes' => ['id' => 'form-mode-wrapper-' . $this->uuid()], |
|
| 182 | + '#attributes' => ['id' => 'form-mode-wrapper-'.$this->uuid()], |
|
| 183 | 183 | ]; |
| 184 | 184 | |
| 185 | 185 | return $form; |
@@ -204,8 +204,8 @@ discard block |
||
| 204 | 204 | */ |
| 205 | 205 | public function updateFormElements($form, FormStateInterface $form_state) { |
| 206 | 206 | $response = new AjaxResponse(); |
| 207 | - $response->addCommand(new ReplaceCommand('#bundle-wrapper-' . $this->uuid(), $this->updateBundle($form, $form_state))); |
|
| 208 | - $response->addCommand(new ReplaceCommand('#form-mode-wrapper-' . $this->uuid(), $this->updateFormMode($form, $form_state))); |
|
| 207 | + $response->addCommand(new ReplaceCommand('#bundle-wrapper-'.$this->uuid(), $this->updateBundle($form, $form_state))); |
|
| 208 | + $response->addCommand(new ReplaceCommand('#form-mode-wrapper-'.$this->uuid(), $this->updateFormMode($form, $form_state))); |
|
| 209 | 209 | return $response; |
| 210 | 210 | } |
| 211 | 211 | |