@@ -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 |