You are here

protected function WidgetBase::selectEntities in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 src/WidgetBase.php \Drupal\entity_browser\WidgetBase::selectEntities()

Dispatches event that informs all subscribers about new selected entities.

Parameters

array $entities: Array of entities.

5 calls to WidgetBase::selectEntities()
DummyWidget::submit in tests/modules/entity_browser_test/src/Plugin/EntityBrowser/Widget/DummyWidget.php
Submits form.
EntityForm::submit in modules/entity_form/src/Plugin/EntityBrowser/Widget/EntityForm.php
Submits form.
MultipleSubmitTestWidget::submit in tests/modules/entity_browser_test/src/Plugin/EntityBrowser/Widget/MultipleSubmitTestWidget.php
Submits form.
Upload::submit in src/Plugin/EntityBrowser/Widget/Upload.php
Submits form.
View::submit in src/Plugin/EntityBrowser/Widget/View.php
Submits form.

File

src/WidgetBase.php, line 338

Class

WidgetBase
Base class for widget plugins.

Namespace

Drupal\entity_browser

Code

protected function selectEntities(array $entities, FormStateInterface $form_state) {
  $selected_entities =& $form_state
    ->get([
    'entity_browser',
    'selected_entities',
  ]);
  $selected_entities = array_merge($selected_entities, $entities);
  $this->eventDispatcher
    ->dispatch(Events::SELECTED, new EntitySelectionEvent($this->configuration['entity_browser_id'], $form_state
    ->get([
    'entity_browser',
    'instance_uuid',
  ]), $entities));
}