@@ -279,7 +279,7 @@ |
||
279 | 279 | /** |
280 | 280 | * Helper function to return commands to return in AjaxResponse. |
281 | 281 | * |
282 | - * @return array |
|
282 | + * @return SelectEntitiesCommand[] |
|
283 | 283 | * An array of ajax commands. |
284 | 284 | */ |
285 | 285 | public function getAjaxCommands(FormStateInterface $form_state) { |
@@ -12,7 +12,6 @@ discard block |
||
12 | 12 | use Drupal\Core\Entity\EntityInterface; |
13 | 13 | use Drupal\Core\Routing\RouteMatchInterface; |
14 | 14 | use Drupal\Core\Url; |
15 | -use Drupal\entity_browser\DisplayAjaxInterface; |
|
16 | 15 | use Drupal\entity_browser\DisplayBase; |
17 | 16 | use Drupal\entity_browser\DisplayRouterInterface; |
18 | 17 | use Drupal\entity_browser\Events\Events; |
@@ -21,7 +20,6 @@ discard block |
||
21 | 20 | use Symfony\Component\EventDispatcher\EventDispatcherInterface; |
22 | 21 | use Drupal\Core\Path\CurrentPathStack; |
23 | 22 | use Drupal\Core\Ajax\AjaxResponse; |
24 | -use Drupal\Core\Ajax\CloseDialogCommand; |
|
25 | 23 | use Drupal\entity_browser\Ajax\SelectEntitiesCommand; |
26 | 24 | use Symfony\Component\HttpKernel\Event\FilterResponseEvent; |
27 | 25 | use Symfony\Component\HttpKernel\KernelEvents; |
@@ -69,7 +69,7 @@ |
||
69 | 69 | */ |
70 | 70 | protected $uuid = NULL; |
71 | 71 | |
72 | - /** |
|
72 | + /** |
|
73 | 73 | * Current request. |
74 | 74 | * |
75 | 75 | * @var \Symfony\Component\HttpFoundation\Request |
@@ -138,13 +138,13 @@ discard block |
||
138 | 138 | // info. |
139 | 139 | $event_object = new RegisterJSCallbacks($this->configuration['entity_browser_id'], $uuid); |
140 | 140 | $event_object->registerCallback('Drupal.entityBrowser.selectionCompleted'); |
141 | - $event = $this->eventDispatcher->dispatch(Events::REGISTER_JS_CALLBACKS, $event_object ); |
|
141 | + $event = $this->eventDispatcher->dispatch(Events::REGISTER_JS_CALLBACKS, $event_object); |
|
142 | 142 | $original_path = $this->currentPath->getPath(); |
143 | 143 | return [ |
144 | 144 | '#theme_wrappers' => ['container'], |
145 | 145 | 'path' => [ |
146 | 146 | '#type' => 'hidden', |
147 | - '#value' => Url::fromRoute('entity_browser.' . $this->configuration['entity_browser_id'], [], [ |
|
147 | + '#value' => Url::fromRoute('entity_browser.'.$this->configuration['entity_browser_id'], [], [ |
|
148 | 148 | 'query' => [ |
149 | 149 | 'uuid' => $uuid, |
150 | 150 | 'original_path' => $original_path, |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | '#value' => $this->configuration['link_text'], |
157 | 157 | '#limit_validation_errors' => [], |
158 | 158 | '#submit' => [], |
159 | - '#name' => 'op_' . $this->configuration['entity_browser_id'], |
|
159 | + '#name' => 'op_'.$this->configuration['entity_browser_id'], |
|
160 | 160 | '#ajax' => [ |
161 | 161 | 'callback' => [$this, 'openModal'], |
162 | 162 | 'event' => 'click', |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | 'data-uuid' => $uuid, |
166 | 166 | ], |
167 | 167 | '#attached' => [ |
168 | - 'library' => ['core/drupal.dialog.ajax', 'entity_browser/modal'], |
|
168 | + 'library' => ['core/drupal.dialog.ajax', 'entity_browser/modal'], |
|
169 | 169 | 'drupalSettings' => [ |
170 | 170 | 'entity_browser' => [ |
171 | 171 | 'modal' => [ |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * An array of ajax commands. |
286 | 286 | */ |
287 | 287 | public function getAjaxCommands(FormStateInterface $form_state) { |
288 | - $entities = array_map(function(EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()];}, $form_state->get(['entity_browser', 'selected_entities'])); |
|
288 | + $entities = array_map(function(EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; }, $form_state->get(['entity_browser', 'selected_entities'])); |
|
289 | 289 | |
290 | 290 | $commands = array(); |
291 | 291 | $commands[] = new SelectEntitiesCommand($this->uuid, $entities); |
@@ -305,13 +305,13 @@ discard block |
||
305 | 305 | public function propagateSelection(FilterResponseEvent $event) { |
306 | 306 | $render = [ |
307 | 307 | 'labels' => [ |
308 | - '#markup' => 'Labels: ' . implode(', ', array_map(function (EntityInterface $item) {return $item->label();}, $this->entities)), |
|
308 | + '#markup' => 'Labels: '.implode(', ', array_map(function(EntityInterface $item) {return $item->label(); }, $this->entities)), |
|
309 | 309 | '#attached' => [ |
310 | 310 | 'library' => ['entity_browser/modal_selection'], |
311 | 311 | 'drupalSettings' => [ |
312 | 312 | 'entity_browser' => [ |
313 | 313 | 'modal' => [ |
314 | - 'entities' => array_map(function (EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()];}, $this->entities), |
|
314 | + 'entities' => array_map(function(EntityInterface $item) {return [$item->id(), $item->uuid(), $item->getEntityTypeId()]; }, $this->entities), |
|
315 | 315 | 'uuid' => $this->request->query->get('uuid'), |
316 | 316 | ], |
317 | 317 | ], |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | * {@inheritdoc} |
328 | 328 | */ |
329 | 329 | public function path() { |
330 | - return '/entity-browser/modal/' . $this->configuration['entity_browser_id']; |
|
330 | + return '/entity-browser/modal/'.$this->configuration['entity_browser_id']; |
|
331 | 331 | } |
332 | 332 | |
333 | 333 | /** |
@@ -54,8 +54,6 @@ |
||
54 | 54 | /** |
55 | 55 | * Constructs widget plugin. |
56 | 56 | * |
57 | - * @param array $configuration |
|
58 | - * A configuration array containing information about the plugin instance. |
|
59 | 57 | * @param string $plugin_id |
60 | 58 | * The plugin_id for the plugin instance. |
61 | 59 | * @param mixed $plugin_definition |
@@ -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; |
@@ -7,7 +7,6 @@ |
||
7 | 7 | |
8 | 8 | namespace Drupal\entity_browser\Plugin\views\display; |
9 | 9 | |
10 | -use Drupal\Core\DependencyInjection\DependencySerializationTrait; |
|
11 | 10 | use Drupal\views\Plugin\views\display\DisplayPluginBase; |
12 | 11 | |
13 | 12 | /** |
@@ -90,7 +90,7 @@ |
||
90 | 90 | $form_element_row_id = $row_id; |
91 | 91 | |
92 | 92 | $substitutions[] = [ |
93 | - 'placeholder' => '<!--form-item-entity_browser_select--' . $form_element_row_id . '-->', |
|
93 | + 'placeholder' => '<!--form-item-entity_browser_select--'.$form_element_row_id.'-->', |
|
94 | 94 | 'field_name' => 'entity_browser_select', |
95 | 95 | 'row_id' => $form_element_row_id, |
96 | 96 | ]; |
@@ -45,10 +45,6 @@ |
||
45 | 45 | /** |
46 | 46 | * Form constructor for the bulk form. |
47 | 47 | * |
48 | - * @param array $form |
|
49 | - * An associative array containing the structure of the form. |
|
50 | - * @param \Drupal\Core\Form\FormStateInterface $form_state |
|
51 | - * The current state of the form. |
|
52 | 48 | */ |
53 | 49 | public function viewsForm(&$render) { |
54 | 50 | // Only add the bulk form options and buttons if there are results. |
@@ -23,7 +23,7 @@ |
||
23 | 23 | * {@inheritdoc} |
24 | 24 | */ |
25 | 25 | public function render(ResultRow $values) { |
26 | - return ViewsRenderPipelineMarkup::create('<!--form-item-' . $this->options['id'] . '--' . $values->index . '-->'); |
|
26 | + return ViewsRenderPipelineMarkup::create('<!--form-item-'.$this->options['id'].'--'.$values->index.'-->'); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -336,7 +336,7 @@ |
||
336 | 336 | '_title_callback' => 'Drupal\entity_browser\Controllers\StandalonePage::title', |
337 | 337 | 'entity_browser_id' => $this->id(), |
338 | 338 | ], |
339 | - ['_permission' => 'access ' . $this->id() . ' entity browser pages'], |
|
339 | + ['_permission' => 'access '.$this->id().' entity browser pages'], |
|
340 | 340 | ['_admin_route' => \Drupal::config('node.settings')->get('use_admin_theme')] |
341 | 341 | ); |
342 | 342 | } |
@@ -28,7 +28,7 @@ |
||
28 | 28 | * {@inheritdoc} |
29 | 29 | */ |
30 | 30 | public function getFormId() { |
31 | - return 'entity_browser_' . $this->entity->id() . '_form'; |
|
31 | + return 'entity_browser_'.$this->entity->id().'_form'; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -116,8 +116,7 @@ |
||
116 | 116 | |
117 | 117 | if (!$this->isSelectionCompleted($form_state)) { |
118 | 118 | $form_state->setRebuild(); |
119 | - } |
|
120 | - else { |
|
119 | + } else { |
|
121 | 120 | $entity_browser->getDisplay()->selectionCompleted($this->getSelectedEntities($form_state)); |
122 | 121 | } |
123 | 122 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | |
64 | 64 | foreach ($browsers as $browser) { |
65 | 65 | if ($browser->route()) { |
66 | - $permissions['access ' . $browser->id() . ' entity browser pages'] = array( |
|
66 | + $permissions['access '.$browser->id().' entity browser pages'] = array( |
|
67 | 67 | 'title' => $this->translationManager->translate('Access @name pages', array('@name' => $browser->label())), |
68 | 68 | 'description' => $this->translationManager->translate('Access pages that %browser uses to operate.', array('%browser' => $browser->label())), |
69 | 69 | ); |
@@ -51,7 +51,7 @@ |
||
51 | 51 | // them only once. Reason for that is how SQL and Views work and we probably |
52 | 52 | // can't do much about it. |
53 | 53 | if (!empty($this->selectedEntities)) { |
54 | - $ids = array_map(function(EntityInterface $item) {return $item->id();}, $this->selectedEntities); |
|
54 | + $ids = array_map(function(EntityInterface $item) {return $item->id(); }, $this->selectedEntities); |
|
55 | 55 | $storage['selection_display_view']->setArguments([implode(',', $ids)]); |
56 | 56 | } |
57 | 57 |
@@ -53,7 +53,7 @@ |
||
53 | 53 | $uploaded_files = $form_state->getValue(['upload'], []); |
54 | 54 | $trigger = $form_state->getTriggeringElement(); |
55 | 55 | // Only validate if we are uploading a file. |
56 | - if (empty($uploaded_files) && $trigger['#value'] == 'Upload') { |
|
56 | + if (empty($uploaded_files) && $trigger['#value'] == 'Upload') { |
|
57 | 57 | $form_state->setError($form['widget']['upload'], t('At least one file should be uploaded.')); |
58 | 58 | } |
59 | 59 | } |