@@ -109,7 +109,7 @@ |
||
109 | 109 | */ |
110 | 110 | public function calculateDependencies() { |
111 | 111 | $dependencies = parent::calculateDependencies(); |
112 | - if ($view_mode = $this->entityTypeManager->getStorage('entity_view_mode')->load($this->configuration['entity_type'] . '.' . $this->configuration['view_mode'])) { |
|
112 | + if ($view_mode = $this->entityTypeManager->getStorage('entity_view_mode')->load($this->configuration['entity_type'].'.'.$this->configuration['view_mode'])) { |
|
113 | 113 | $dependencies[$view_mode->getConfigDependencyKey()][] = $view_mode->getConfigDependencyName(); |
114 | 114 | } |
115 | 115 | return $dependencies; |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | $display = ['#markup' => $display]; |
114 | 114 | } |
115 | 115 | |
116 | - $form['selected']['items_' . $entity->id() . '_' . $id] = [ |
|
116 | + $form['selected']['items_'.$entity->id().'_'.$id] = [ |
|
117 | 117 | '#theme_wrappers' => ['container'], |
118 | 118 | '#attributes' => [ |
119 | 119 | 'class' => ['item-container'], |
@@ -124,11 +124,11 @@ discard block |
||
124 | 124 | '#type' => 'submit', |
125 | 125 | '#value' => $this->t('Remove'), |
126 | 126 | '#submit' => [[get_class($this), 'removeItemSubmit']], |
127 | - '#name' => 'remove_' . $entity->id() . '_' . $id, |
|
127 | + '#name' => 'remove_'.$entity->id().'_'.$id, |
|
128 | 128 | '#attributes' => [ |
129 | 129 | 'class' => ['entity-browser-remove-selected-entity'], |
130 | 130 | 'data-row-id' => $id, |
131 | - 'data-remove-entity' => 'items_' . $entity->id(), |
|
131 | + 'data-remove-entity' => 'items_'.$entity->id(), |
|
132 | 132 | ], |
133 | 133 | ], |
134 | 134 | 'weight' => [ |
@@ -290,10 +290,10 @@ discard block |
||
290 | 290 | foreach ($entity_ids as $entity_pair_info) { |
291 | 291 | $last_entity_id = $selected_entities[$selected_entity_keys[$key_index]]->id(); |
292 | 292 | |
293 | - $html = $renderer->render($form['selection_display']['selected']['items_' . $last_entity_id . '_' . $selected_entity_keys[$key_index]]); |
|
293 | + $html = $renderer->render($form['selection_display']['selected']['items_'.$last_entity_id.'_'.$selected_entity_keys[$key_index]]); |
|
294 | 294 | |
295 | 295 | $ajax->addCommand( |
296 | - new ReplaceCommand('div[id="' . $entity_pair_info['proxy_id'] . '"]', static::trimSingleHtmlTag($html)) |
|
296 | + new ReplaceCommand('div[id="'.$entity_pair_info['proxy_id'].'"]', static::trimSingleHtmlTag($html)) |
|
297 | 297 | ); |
298 | 298 | |
299 | 299 | $key_index++; |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | // Remove weight of entity being removed. |
368 | 368 | $form_state->unsetValue([ |
369 | 369 | 'selected', |
370 | - $triggering_element['#attributes']['data-remove-entity'] . '_' . $triggering_element['#attributes']['data-row-id'], |
|
370 | + $triggering_element['#attributes']['data-remove-entity'].'_'.$triggering_element['#attributes']['data-row-id'], |
|
371 | 371 | ]); |
372 | 372 | |
373 | 373 | // Remove entity itself. |
@@ -146,9 +146,9 @@ discard block |
||
146 | 146 | $xpath = new \DOMXPath($dom); |
147 | 147 | foreach ($commands as $command) { |
148 | 148 | if ($command['command'] == 'insert' && $command['method'] == 'replaceWith') { |
149 | - $wrapperNode = $xpath->query('//*[@id="' . ltrim($command['selector'], '#') . '"]')->item(0); |
|
149 | + $wrapperNode = $xpath->query('//*[@id="'.ltrim($command['selector'], '#').'"]')->item(0); |
|
150 | 150 | $newDom = new \DOMDocument(); |
151 | - @$newDom->loadHTML('<div>' . $command['data'] . '</div>'); |
|
151 | + @$newDom->loadHTML('<div>'.$command['data'].'</div>'); |
|
152 | 152 | $newNode = @$dom->importNode($newDom->documentElement->firstChild->firstChild, TRUE); |
153 | 153 | $wrapperNode->parentNode->replaceChild($newNode, $wrapperNode); |
154 | 154 | $content = $dom->saveHTML(); |
@@ -239,20 +239,20 @@ discard block |
||
239 | 239 | $this->assertUrl('/admin/config/content/entity_browser/test_entity_browser/selection_display', ['query' => ['js' => 'nojs']]); |
240 | 240 | |
241 | 241 | $this->drupalPostForm(NULL, [], 'Next'); |
242 | - $this->assertFieldById('edit-table-' . $first_uuid . '-label', 'upload', 'Correct value for widget label found.'); |
|
243 | - $this->assertFieldChecked('edit-table-' . $first_uuid . '-form-multiple', 'Accept multiple files option is enabled by default.'); |
|
242 | + $this->assertFieldById('edit-table-'.$first_uuid.'-label', 'upload', 'Correct value for widget label found.'); |
|
243 | + $this->assertFieldChecked('edit-table-'.$first_uuid.'-form-multiple', 'Accept multiple files option is enabled by default.'); |
|
244 | 244 | $this->assertText('Multiple uploads will only be accepted if the source field allows more than one value.'); |
245 | - $this->assertFieldById('edit-table-' . $first_uuid . '-form-upload-location', 'public://', 'Correct value for upload location found.'); |
|
246 | - $this->assertFieldByXPath("//input[@data-drupal-selector='edit-table-" . $first_uuid . "-form-submit-text']", 'Select files', 'Correct value for submit text found.'); |
|
247 | - $this->assertFieldById('edit-table-' . $second_uuid . '-label', 'entity_form', 'Correct value for widget label found.'); |
|
248 | - $this->assertOptionSelectedWithDrupalSelector('edit-table-' . $second_uuid . '-form-entity-type', 'user', 'Correct value for entity type found.'); |
|
249 | - $this->assertOptionSelectedWithDrupalSelector('edit-table-' . $second_uuid . '-form-bundle-select', 'user', 'Correct value for bundle found.'); |
|
250 | - $this->assertOptionSelectedWithDrupalSelector('edit-table-' . $second_uuid . '-form-form-mode-form-select', 'register', 'Correct value for form modes found.'); |
|
251 | - $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.'); |
|
245 | + $this->assertFieldById('edit-table-'.$first_uuid.'-form-upload-location', 'public://', 'Correct value for upload location found.'); |
|
246 | + $this->assertFieldByXPath("//input[@data-drupal-selector='edit-table-".$first_uuid."-form-submit-text']", 'Select files', 'Correct value for submit text found.'); |
|
247 | + $this->assertFieldById('edit-table-'.$second_uuid.'-label', 'entity_form', 'Correct value for widget label found.'); |
|
248 | + $this->assertOptionSelectedWithDrupalSelector('edit-table-'.$second_uuid.'-form-entity-type', 'user', 'Correct value for entity type found.'); |
|
249 | + $this->assertOptionSelectedWithDrupalSelector('edit-table-'.$second_uuid.'-form-bundle-select', 'user', 'Correct value for bundle found.'); |
|
250 | + $this->assertOptionSelectedWithDrupalSelector('edit-table-'.$second_uuid.'-form-form-mode-form-select', 'register', 'Correct value for form modes found.'); |
|
251 | + $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.'); |
|
252 | 252 | |
253 | - $this->drupalPostForm(NULL, ['table[' . $first_uuid . '][form][multiple]' => FALSE], 'Finish'); |
|
253 | + $this->drupalPostForm(NULL, ['table['.$first_uuid.'][form][multiple]' => FALSE], 'Finish'); |
|
254 | 254 | $this->drupalGet('/admin/config/content/entity_browser/test_entity_browser/widgets'); |
255 | - $this->assertNoFieldChecked('edit-table-' . $first_uuid . '-form-multiple', 'Accept multiple files option is disabled.'); |
|
255 | + $this->assertNoFieldChecked('edit-table-'.$first_uuid.'-form-multiple', 'Accept multiple files option is disabled.'); |
|
256 | 256 | |
257 | 257 | $this->drupalLogout(); |
258 | 258 | $this->drupalGet('/admin/config/content/entity_browser/test_entity_browser'); |
@@ -64,7 +64,7 @@ |
||
64 | 64 | * {@inheritdoc} |
65 | 65 | */ |
66 | 66 | public function getFormId() { |
67 | - return 'entity_browser_' . $this->entityBrowser->id() . '_form'; |
|
67 | + return 'entity_browser_'.$this->entityBrowser->id().'_form'; |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -105,8 +105,7 @@ discard block |
||
105 | 105 | $form_state->set('entity_form_initialized', TRUE); |
106 | 106 | if ($this->getRequest()->query->has('uuid')) { |
107 | 107 | $form_state->set(['entity_browser', 'instance_uuid'], $this->getRequest()->query->get('uuid')); |
108 | - } |
|
109 | - else { |
|
108 | + } else { |
|
110 | 109 | $form_state->set(['entity_browser', 'instance_uuid'], $this->uuidGenerator->generate()); |
111 | 110 | } |
112 | 111 | $form_state->set(['entity_browser', 'selected_entities'], []); |
@@ -159,8 +158,7 @@ discard block |
||
159 | 158 | $widget = $this->entityBrowser->getWidget($current_widget_id); |
160 | 159 | if ($widget->access()->isAllowed()) { |
161 | 160 | $form[$form['#browser_parts']['widget']] = $widget->getForm($form, $form_state, $this->entityBrowser->getAdditionalWidgetParameters()); |
162 | - } |
|
163 | - else { |
|
161 | + } else { |
|
164 | 162 | drupal_set_message($this->t('Access to the widget forbidden.'), 'warning'); |
165 | 163 | } |
166 | 164 | |
@@ -231,8 +229,7 @@ discard block |
||
231 | 229 | |
232 | 230 | if (!$this->isSelectionCompleted($form_state)) { |
233 | 231 | $form_state->setRebuild(); |
234 | - } |
|
235 | - else { |
|
232 | + } else { |
|
236 | 233 | $this->entityBrowser->getDisplay()->selectionCompleted($this->getSelectedEntities($form_state)); |
237 | 234 | } |
238 | 235 | } |
@@ -53,8 +53,6 @@ discard block |
||
53 | 53 | /** |
54 | 54 | * Sets the id of the widget selector plugin. |
55 | 55 | * |
56 | - * @param string $display |
|
57 | - * The id of the widget selector plugin. |
|
58 | 56 | * |
59 | 57 | * @return \Drupal\entity_browser\EntityBrowserInterface |
60 | 58 | * The class instance this method is called on. |
@@ -64,8 +62,6 @@ discard block |
||
64 | 62 | /** |
65 | 63 | * Sets the id of the selection display plugin. |
66 | 64 | * |
67 | - * @param string $display |
|
68 | - * The id of the selection display plugin. |
|
69 | 65 | * |
70 | 66 | * @return \Drupal\entity_browser\EntityBrowserInterface |
71 | 67 | * The class instance this method is called on. |
@@ -136,8 +136,7 @@ |
||
136 | 136 | /** @var \Drupal\entity_browser\EntityBrowserInterface $entity_browser */ |
137 | 137 | if (is_string($element['#entity_browser'])) { |
138 | 138 | $entity_browser = EntityBrowser::load($element['#entity_browser']); |
139 | - } |
|
140 | - else { |
|
139 | + } else { |
|
141 | 140 | $entity_browser = $element['#entity_browser']; |
142 | 141 | } |
143 | 142 |
@@ -154,8 +154,8 @@ discard block |
||
154 | 154 | } |
155 | 155 | |
156 | 156 | $default_value = implode(' ', array_map( |
157 | - function (EntityInterface $item) { |
|
158 | - return $item->getEntityTypeId() . ':' . $item->id(); |
|
157 | + function(EntityInterface $item) { |
|
158 | + return $item->getEntityTypeId().':'.$item->id(); |
|
159 | 159 | }, |
160 | 160 | $entity_browser_preselected_entities |
161 | 161 | )); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | ] |
190 | 190 | ); |
191 | 191 | |
192 | - $hidden_id = Html::getUniqueId($element['#id'] . '-target'); |
|
192 | + $hidden_id = Html::getUniqueId($element['#id'].'-target'); |
|
193 | 193 | $element['entity_ids'] = [ |
194 | 194 | '#type' => 'hidden', |
195 | 195 | '#id' => $hidden_id, |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | $entity_browser->getDisplay()->getUuid() => [ |
203 | 203 | 'cardinality' => $element['#cardinality'], |
204 | 204 | 'selection_mode' => $element['#selection_mode'], |
205 | - 'selector' => '#' . $hidden_id, |
|
205 | + 'selector' => '#'.$hidden_id, |
|
206 | 206 | ], |
207 | 207 | ]; |
208 | 208 | } |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | } |
244 | 244 | |
245 | 245 | return array_map( |
246 | - function ($item) { |
|
246 | + function($item) { |
|
247 | 247 | list($entity_type, $entity_id) = explode(':', $item); |
248 | 248 | return \Drupal::entityTypeManager()->getStorage($entity_type)->load($entity_id); |
249 | 249 | }, |
@@ -65,7 +65,7 @@ |
||
65 | 65 | $file = File::load(1); |
66 | 66 | // Test entity browser token that has upload location configured to |
67 | 67 | // public://[current-user:account-name]/. |
68 | - $this->assertEqual($file->getFileUri(), 'public://' . $account->getUsername() . '/' . $file->getFilename(), 'Image has the correct uri.'); |
|
68 | + $this->assertEqual($file->getFileUri(), 'public://'.$account->getUsername().'/'.$file->getFilename(), 'Image has the correct uri.'); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | } |
@@ -52,22 +52,22 @@ |
||
52 | 52 | $this->assertFieldByXPath("//input[@type='hidden' and @id='edit-fancy-entity-browser-target']", '', "Entity browser's hidden element found."); |
53 | 53 | |
54 | 54 | $edit = [ |
55 | - 'fancy_entity_browser[entity_ids]' => $this->nodes[0]->getEntityTypeId() . ':' . $this->nodes[0]->id() . ' ' . $this->nodes[1]->getEntityTypeId() . ':' . $this->nodes[1]->id(), |
|
55 | + 'fancy_entity_browser[entity_ids]' => $this->nodes[0]->getEntityTypeId().':'.$this->nodes[0]->id().' '.$this->nodes[1]->getEntityTypeId().':'.$this->nodes[1]->id(), |
|
56 | 56 | ]; |
57 | 57 | $this->drupalPostForm(NULL, $edit, 'Submit'); |
58 | - $expected = 'Selected entities: ' . $this->nodes[0]->label() . ', ' . $this->nodes[1]->label(); |
|
58 | + $expected = 'Selected entities: '.$this->nodes[0]->label().', '.$this->nodes[1]->label(); |
|
59 | 59 | $this->assertText($expected, 'Selected entities detected.'); |
60 | 60 | |
61 | - $default_entity = $this->nodes[0]->getEntityTypeId() . ':' . $this->nodes[0]->id(); |
|
61 | + $default_entity = $this->nodes[0]->getEntityTypeId().':'.$this->nodes[0]->id(); |
|
62 | 62 | $this->drupalGet('/test-element', ['query' => ['default_entity' => $default_entity, 'selection_mode' => EntityBrowserElement::SELECTION_MODE_EDIT]]); |
63 | 63 | $this->assertLink('Select entities', 0, 'Trigger link found.'); |
64 | 64 | $this->assertFieldByXPath("//input[@type='hidden' and @id='edit-fancy-entity-browser-target']", $default_entity, "Entity browser's hidden element found."); |
65 | 65 | |
66 | 66 | $edit = [ |
67 | - 'fancy_entity_browser[entity_ids]' => $this->nodes[1]->getEntityTypeId() . ':' . $this->nodes[1]->id() . ' ' . $this->nodes[0]->getEntityTypeId() . ':' . $this->nodes[0]->id(), |
|
67 | + 'fancy_entity_browser[entity_ids]' => $this->nodes[1]->getEntityTypeId().':'.$this->nodes[1]->id().' '.$this->nodes[0]->getEntityTypeId().':'.$this->nodes[0]->id(), |
|
68 | 68 | ]; |
69 | 69 | $this->drupalPostForm(NULL, $edit, 'Submit'); |
70 | - $expected = 'Selected entities: ' . $this->nodes[1]->label() . ', ' . $this->nodes[0]->label(); |
|
70 | + $expected = 'Selected entities: '.$this->nodes[1]->label().', '.$this->nodes[0]->label(); |
|
71 | 71 | $this->assertText($expected, 'Selected entities detected.'); |
72 | 72 | } |
73 | 73 |
@@ -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 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | ->get('entity_browser.browser.test_update'); |
54 | 54 | |
55 | 55 | $this->assertNull($browser->get('submit_text'), 'Old submit text is gone'); |
56 | - $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 | + $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.'); |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | /** |