@@ -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; |
@@ -25,7 +25,6 @@ |
||
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Plugin implementation of the 'entity_reference' widget for entity browser. |
| 28 | - |
|
| 29 | 28 | * @FieldWidget( |
| 30 | 29 | * id = "entity_browser_entity_reference", |
| 31 | 30 | * label = @Translation("Entity browser"), |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | } |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - $id = Html::getUniqueId('field-' . $this->fieldDefinition->getName() . '-display-settings-wrapper'); |
|
| 153 | + $id = Html::getUniqueId('field-'.$this->fieldDefinition->getName().'-display-settings-wrapper'); |
|
| 154 | 154 | $element['field_widget_display'] = [ |
| 155 | 155 | '#title' => t('Entity display plugin'), |
| 156 | 156 | '#type' => 'select', |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | '#type' => 'fieldset', |
| 185 | 185 | '#title' => t('Entity display plugin configuration'), |
| 186 | 186 | '#tree' => TRUE, |
| 187 | - '#prefix' => '<div id="' . $id . '">', |
|
| 187 | + '#prefix' => '<div id="'.$id.'">', |
|
| 188 | 188 | '#suffix' => '</div>', |
| 189 | 189 | ]; |
| 190 | 190 | |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | * A key for form state storage. |
| 282 | 282 | */ |
| 283 | 283 | protected function getFormStateKey(FieldItemListInterface $items) { |
| 284 | - return $items->getEntity()->uuid() . ':' . $items->getFieldDefinition()->getName(); |
|
| 284 | + return $items->getEntity()->uuid().':'.$items->getFieldDefinition()->getName(); |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | /** |
@@ -317,7 +317,7 @@ discard block |
||
| 317 | 317 | } |
| 318 | 318 | // Submit was triggered by one of the "Remove" buttons. We need to walk |
| 319 | 319 | // few levels up to read value of "target_id" element. |
| 320 | - elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], $this->fieldDefinition->getName() . '_remove_') === 0) { |
|
| 320 | + elseif ($trigger['#type'] == 'submit' && strpos($trigger['#name'], $this->fieldDefinition->getName().'_remove_') === 0) { |
|
| 321 | 321 | $parents = array_merge(array_slice($trigger['#parents'], 0, -static::$deleteDepth), ['target_id']); |
| 322 | 322 | } |
| 323 | 323 | |
@@ -354,8 +354,8 @@ discard block |
||
| 354 | 354 | // results. |
| 355 | 355 | $form_state->set(['entity_browser_widget', $this->getFormStateKey($items)], $ids); |
| 356 | 356 | |
| 357 | - $hidden_id = Html::getUniqueId('edit-' . $this->fieldDefinition->getName() . '-target-id'); |
|
| 358 | - $details_id = Html::getUniqueId('edit-' . $this->fieldDefinition->getName()); |
|
| 357 | + $hidden_id = Html::getUniqueId('edit-'.$this->fieldDefinition->getName().'-target-id'); |
|
| 358 | + $details_id = Html::getUniqueId('edit-'.$this->fieldDefinition->getName()); |
|
| 359 | 359 | /** @var \Drupal\entity_browser\EntityBrowserInterface $entity_browser */ |
| 360 | 360 | $entity_browser = $this->entityManager->getStorage('entity_browser')->load($this->getSetting('entity_browser')); |
| 361 | 361 | |
@@ -485,7 +485,7 @@ discard block |
||
| 485 | 485 | '#theme_wrappers' => ['container'], |
| 486 | 486 | '#attributes' => ['class' => ['entities-list']], |
| 487 | 487 | 'items' => array_map( |
| 488 | - function (ContentEntityInterface $entity) use ($field_widget_display, $details_id, $field_parents) { |
|
| 488 | + function(ContentEntityInterface $entity) use ($field_widget_display, $details_id, $field_parents) { |
|
| 489 | 489 | $display = $field_widget_display->view($entity); |
| 490 | 490 | if (is_string($display)) { |
| 491 | 491 | $display = ['#markup' => $display]; |
@@ -505,7 +505,7 @@ discard block |
||
| 505 | 505 | 'wrapper' => $details_id, |
| 506 | 506 | ], |
| 507 | 507 | '#submit' => [[get_class($this), 'removeItemSubmit']], |
| 508 | - '#name' => $this->fieldDefinition->getName() . '_remove_' . $entity->id(), |
|
| 508 | + '#name' => $this->fieldDefinition->getName().'_remove_'.$entity->id(), |
|
| 509 | 509 | '#limit_validation_errors' => [array_merge($field_parents, [$this->fieldDefinition->getName()])], |
| 510 | 510 | '#attributes' => ['data-entity-id' => $entity->id()], |
| 511 | 511 | '#access' => (bool) $this->getSetting('field_widget_remove') |
@@ -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 | ]; |
@@ -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. |
@@ -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. |
@@ -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 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 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 | /** |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | '#type' => 'checkbox', |
| 63 | 63 | '#title' => $this->t('Select this item'), |
| 64 | 64 | '#title_display' => 'invisible', |
| 65 | - '#return_value' => $entity->getEntityTypeId() . ':' . $entity->id(), |
|
| 65 | + '#return_value' => $entity->getEntityTypeId().':'.$entity->id(), |
|
| 66 | 66 | '#attributes' => ['name' => "entity_browser_select[$row_index]"], |
| 67 | 67 | '#default_value' => NULL, |
| 68 | 68 | ]; |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | $form['widget'] = [ |
| 76 | 76 | '#type' => 'select', |
| 77 | 77 | '#title' => $this->t('Add widget plugin'), |
| 78 | - '#options' => ['_none_' => '- ' . $this->t('Select a widget to add it') . ' -'] + $widgets, |
|
| 78 | + '#options' => ['_none_' => '- '.$this->t('Select a widget to add it').' -'] + $widgets, |
|
| 79 | 79 | '#ajax' => [ |
| 80 | 80 | 'callback' => [get_class($this), 'addWidgetCallback'], |
| 81 | 81 | 'wrapper' => 'widgets', |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | $row['remove'] = [ |
| 126 | 126 | '#type' => 'submit', |
| 127 | 127 | '#value' => $this->t('Delete'), |
| 128 | - '#name' => 'remove' . $uuid, |
|
| 128 | + '#name' => 'remove'.$uuid, |
|
| 129 | 129 | '#ajax' => [ |
| 130 | 130 | 'callback' => [get_class($this), 'addWidgetCallback'], |
| 131 | 131 | 'wrapper' => 'widgets', |
@@ -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\SharedTempStoreFactory; |
|
| 17 | 16 | use Symfony\Component\DependencyInjection\ContainerInterface; |
| 18 | 17 | |
| 19 | 18 | /** |