You are here

protected function DummyWidget::prepareEntities in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 tests/modules/entity_browser_test/src/Plugin/EntityBrowser/Widget/DummyWidget.php \Drupal\entity_browser_test\Plugin\EntityBrowser\Widget\DummyWidget::prepareEntities()

Prepares the entities without saving them.

We need this method when we want to validate or perform other operations before submit.

Parameters

array $form: Complete form.

\Drupal\Core\Form\FormStateInterface $form_state: The form state object.

Return value

\Drupal\Core\Entity\EntityInterface[] Array of entities.

Overrides WidgetBase::prepareEntities

File

tests/modules/entity_browser_test/src/Plugin/EntityBrowser/Widget/DummyWidget.php, line 55

Class

DummyWidget
Dummy widget implementation for test purposes.

Namespace

Drupal\entity_browser_test\Plugin\EntityBrowser\Widget

Code

protected function prepareEntities(array $form, FormStateInterface $form_state) {
  return $form_state
    ->getValue('dummy_entities', []);
}