@@ -24,7 +24,7 @@ |
||
24 | 24 | /** |
25 | 25 | * {@inheritdoc} |
26 | 26 | */ |
27 | - public function getForm(array &$form, FormStateInterface &$form_state) { |
|
27 | + public function getForm(array &$form, FormStateInterface&$form_state) { |
|
28 | 28 | return array(); |
29 | 29 | } |
30 | 30 |
@@ -24,10 +24,10 @@ |
||
24 | 24 | /** |
25 | 25 | * {@inheritdoc} |
26 | 26 | */ |
27 | - public function getForm(array &$form = array(), FormStateInterface &$form_state = NULL) { |
|
27 | + public function getForm(array &$form = array(), FormStateInterface&$form_state = NULL) { |
|
28 | 28 | $element = []; |
29 | 29 | foreach ($this->widget_ids as $id => $label) { |
30 | - $name = 'tab_selector_' . $id; |
|
30 | + $name = 'tab_selector_'.$id; |
|
31 | 31 | $element[$name] = array( |
32 | 32 | '#type' => 'button', |
33 | 33 | '#attributes' => ['class' => ['tab']], |
@@ -24,7 +24,6 @@ discard block |
||
24 | 24 | |
25 | 25 | /** |
26 | 26 | * Plugin implementation of the 'entity_reference' widget for entity browser. |
27 | - |
|
28 | 27 | * @FieldWidget( |
29 | 28 | * id = "entity_browser_entity_reference", |
30 | 29 | * label = @Translation("Entity browser"), |
@@ -174,8 +173,8 @@ discard block |
||
174 | 173 | } |
175 | 174 | |
176 | 175 | /** |
177 | - * {@inheritdoc} |
|
178 | - */ |
|
176 | + * {@inheritdoc} |
|
177 | + */ |
|
179 | 178 | public function settingsSummary() { |
180 | 179 | $summary = []; |
181 | 180 | $entity_browser_id = $this->getSetting('entity_browser'); |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | $displays[$id] = $definition['label']; |
129 | 129 | } |
130 | 130 | |
131 | - $id = Html::getUniqueId('field-' . $this->fieldDefinition->getName() . '-display-settings-wrapper'); |
|
131 | + $id = Html::getUniqueId('field-'.$this->fieldDefinition->getName().'-display-settings-wrapper'); |
|
132 | 132 | $element['field_widget_display'] = [ |
133 | 133 | '#title' => t('Entity display plugin'), |
134 | 134 | '#type' => 'select', |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | '#type' => 'fieldset', |
145 | 145 | '#title' => t('Entity display plugin configuration'), |
146 | 146 | '#tree' => TRUE, |
147 | - '#prefix' => '<div id="' . $id . '">', |
|
147 | + '#prefix' => '<div id="'.$id.'">', |
|
148 | 148 | '#suffix' => '</div>', |
149 | 149 | ]; |
150 | 150 | |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | } |
219 | 219 | // Submit was triggered by one of the "Remove" buttons. We need to walk |
220 | 220 | // few levels up to read value of "target_id" element. |
221 | - elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], $this->fieldDefinition->getName() . '_remove_') === 0) { |
|
221 | + elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], $this->fieldDefinition->getName().'_remove_') === 0) { |
|
222 | 222 | $parents = array_merge(array_slice($trigger['#parents'], 0, -4), ['target_id']); |
223 | 223 | } |
224 | 224 | |
@@ -241,8 +241,8 @@ discard block |
||
241 | 241 | } |
242 | 242 | $ids = array_filter($ids); |
243 | 243 | |
244 | - $hidden_id = Html::getUniqueId('edit-' . $this->fieldDefinition->getName() . '-target-id'); |
|
245 | - $details_id = Html::getUniqueId('edit-' . $this->fieldDefinition->getName()); |
|
244 | + $hidden_id = Html::getUniqueId('edit-'.$this->fieldDefinition->getName().'-target-id'); |
|
245 | + $details_id = Html::getUniqueId('edit-'.$this->fieldDefinition->getName()); |
|
246 | 246 | /** @var \Drupal\entity_browser\EntityBrowserInterface $entity_browser */ |
247 | 247 | $entity_browser = $this->entityManager->getStorage('entity_browser')->load($this->getSetting('entity_browser')); |
248 | 248 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | 'wrapper' => $details_id, |
308 | 308 | ], |
309 | 309 | '#submit' => [[get_class($this), 'removeItemSubmit']], |
310 | - '#name' => $this->fieldDefinition->getName() . '_remove_' . $id, |
|
310 | + '#name' => $this->fieldDefinition->getName().'_remove_'.$id, |
|
311 | 311 | '#limit_validation_errors' => [array_merge($field_parents, [$this->fieldDefinition->getName()])], |
312 | 312 | '#attributes' => ['data-entity-id' => $id], |
313 | 313 | ] |
@@ -183,8 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | if (empty($entity_browser_id)) { |
185 | 185 | return [t('No entity browser selected.')]; |
186 | - } |
|
187 | - else { |
|
186 | + } else { |
|
188 | 187 | $browser = $this->entityManager->getStorage('entity_browser') |
189 | 188 | ->load($entity_browser_id); |
190 | 189 | $summary[] = t('Entity browser: @browser', ['@browser' => $browser->label()]); |
@@ -355,8 +354,7 @@ discard block |
||
355 | 354 | // information to return correct part of the form. |
356 | 355 | if (!empty($trigger['#ajax']['event']) && $trigger['#ajax']['event'] == 'entity_browser_value_updated') { |
357 | 356 | $parents = array_slice($trigger['#array_parents'], 0, -2); |
358 | - } |
|
359 | - elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], '_remove_')) { |
|
357 | + } elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], '_remove_')) { |
|
360 | 358 | $parents = array_slice($trigger['#array_parents'], 0, -4); |
361 | 359 | } |
362 | 360 |
@@ -16,8 +16,6 @@ |
||
16 | 16 | use Drupal\Core\Field\WidgetBase; |
17 | 17 | use Drupal\Core\Form\FormStateInterface; |
18 | 18 | use Drupal\Core\Plugin\ContainerFactoryPluginInterface; |
19 | -use Drupal\entity_browser\Events\Events; |
|
20 | -use Drupal\entity_browser\Events\RegisterJSCallbacks; |
|
21 | 19 | use Drupal\entity_browser\FieldWidgetDisplayManager; |
22 | 20 | use Symfony\Component\DependencyInjection\ContainerInterface; |
23 | 21 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
@@ -62,7 +62,7 @@ |
||
62 | 62 | /** @var $browser \Drupal\entity_browser\EntityBrowserInterface */ |
63 | 63 | $browser = $this->browserStorage->load($id); |
64 | 64 | if ($route = $browser->route()) { |
65 | - $collection->add('entity_browser.' . $browser->id(), $route); |
|
65 | + $collection->add('entity_browser.'.$browser->id(), $route); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 |
@@ -30,7 +30,7 @@ |
||
30 | 30 | * @return array |
31 | 31 | * Form structure. |
32 | 32 | */ |
33 | - public function getForm(array &$form, FormStateInterface &$form_state); |
|
33 | + public function getForm(array &$form, FormStateInterface&$form_state); |
|
34 | 34 | |
35 | 35 | /** |
36 | 36 | * Sets the default widget. |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | // info. |
135 | 135 | $event_object = new RegisterJSCallbacks($this->configuration['entity_browser_id'], $uuid); |
136 | 136 | $event_object->registerCallback('Drupal.entityBrowser.selectionCompleted'); |
137 | - $event = $this->eventDispatcher->dispatch(Events::REGISTER_JS_CALLBACKS, $event_object ); |
|
137 | + $event = $this->eventDispatcher->dispatch(Events::REGISTER_JS_CALLBACKS, $event_object); |
|
138 | 138 | $original_path = $this->currentPath->getPath(); |
139 | 139 | return [ |
140 | 140 | '#theme_wrappers' => ['container'], |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | 'entity_browser' => [ |
155 | 155 | 'iframe' => [ |
156 | 156 | $uuid => [ |
157 | - 'src' => Url::fromRoute('entity_browser.' . $this->configuration['entity_browser_id'], [], [ |
|
157 | + 'src' => Url::fromRoute('entity_browser.'.$this->configuration['entity_browser_id'], [], [ |
|
158 | 158 | 'query' => [ |
159 | 159 | 'uuid' => $uuid, |
160 | 160 | 'original_path' => $original_path, |
@@ -192,13 +192,13 @@ discard block |
||
192 | 192 | public function propagateSelection(FilterResponseEvent $event) { |
193 | 193 | $render = [ |
194 | 194 | 'labels' => [ |
195 | - '#markup' => 'Labels: ' . implode(', ', array_map(function (EntityInterface $item) {return $item->label();}, $this->entities)), |
|
195 | + '#markup' => 'Labels: '.implode(', ', array_map(function(EntityInterface $item) {return $item->label(); }, $this->entities)), |
|
196 | 196 | '#attached' => [ |
197 | 197 | 'library' => ['entity_browser/iframe_selection'], |
198 | 198 | 'drupalSettings' => [ |
199 | 199 | 'entity_browser' => [ |
200 | 200 | 'iframe' => [ |
201 | - 'entities' => array_map(function (EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()];}, $this->entities), |
|
201 | + 'entities' => array_map(function(EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; }, $this->entities), |
|
202 | 202 | 'uuid' => $this->request->query->get('uuid'), |
203 | 203 | ], |
204 | 204 | ], |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | * {@inheritdoc} |
225 | 225 | */ |
226 | 226 | public function path() { |
227 | - return '/entity-browser/iframe/' . $this->configuration['entity_browser_id']; |
|
227 | + return '/entity-browser/iframe/'.$this->configuration['entity_browser_id']; |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | } |
@@ -59,8 +59,6 @@ discard block |
||
59 | 59 | /** |
60 | 60 | * Sets the id of the widget selector plugin |
61 | 61 | * |
62 | - * @param string $display |
|
63 | - * The id of the widget selector plugin. |
|
64 | 62 | * |
65 | 63 | * @return \Drupal\entity_browser\EntityBrowserInterface |
66 | 64 | * The class instance this method is called on. |
@@ -70,8 +68,6 @@ discard block |
||
70 | 68 | /** |
71 | 69 | * Sets the id of the selection display plugin |
72 | 70 | * |
73 | - * @param string $display |
|
74 | - * The id of the selection display plugin. |
|
75 | 71 | * |
76 | 72 | * @return \Drupal\entity_browser\EntityBrowserInterface |
77 | 73 | * The class instance this method is called on. |
@@ -8,7 +8,6 @@ |
||
8 | 8 | namespace Drupal\entity_browser; |
9 | 9 | |
10 | 10 | use Drupal\Core\Config\Entity\ConfigEntityInterface; |
11 | -use Drupal\Core\Form\FormStateInterface; |
|
12 | 11 | |
13 | 12 | /** |
14 | 13 | * Provides an interface defining an entity browser entity. |
@@ -61,7 +61,7 @@ |
||
61 | 61 | * |
62 | 62 | * @param \Drupal\entity_browser\DisplayManager $display_manager |
63 | 63 | * Entity browser display plugin manager. |
64 | - * @param \Drupal\entity_browser\WidgetSelectorManager $widget_selector |
|
64 | + * @param \Drupal\entity_browser\WidgetSelectorManager $widget_selector_manager |
|
65 | 65 | * Entity browser widget selector plugin manager. |
66 | 66 | * @param \Drupal\entity_browser\SelectionDisplayManager |
67 | 67 | * Entity browser selection display plugin manager. |
@@ -13,7 +13,6 @@ |
||
13 | 13 | use Drupal\entity_browser\SelectionDisplayManager; |
14 | 14 | use Drupal\entity_browser\WidgetManager; |
15 | 15 | use Drupal\entity_browser\WidgetSelectorManager; |
16 | -use Drupal\user\SharedTempStore; |
|
17 | 16 | use Drupal\user\SharedTempStoreFactory; |
18 | 17 | use Symfony\Component\DependencyInjection\ContainerInterface; |
19 | 18 |
@@ -80,7 +80,7 @@ |
||
80 | 80 | $form['widget'] = [ |
81 | 81 | '#type' => 'select', |
82 | 82 | '#title' => $this->t('Add widget plugin'), |
83 | - '#options' => ['_none_' => '- ' . $this->t('Select a widget to add it') . ' -'] + $widgets, |
|
83 | + '#options' => ['_none_' => '- '.$this->t('Select a widget to add it').' -'] + $widgets, |
|
84 | 84 | '#ajax' => [ |
85 | 85 | 'callback' => [get_class($this), 'addWidgetCallback'], |
86 | 86 | 'wrapper' => 'widgets', |