You are here

protected function EntityForm::prepareEntities in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 modules/entity_form/src/Plugin/EntityBrowser/Widget/EntityForm.php \Drupal\entity_browser_entity_form\Plugin\EntityBrowser\Widget\EntityForm::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

1 call to EntityForm::prepareEntities()
EntityForm::submit in modules/entity_form/src/Plugin/EntityBrowser/Widget/EntityForm.php
Submits form.

File

modules/entity_form/src/Plugin/EntityBrowser/Widget/EntityForm.php, line 127

Class

EntityForm
Provides entity form widget.

Namespace

Drupal\entity_browser_entity_form\Plugin\EntityBrowser\Widget

Code

protected function prepareEntities(array $form, FormStateInterface $form_state) {
  return [
    $form[$form['#browser_parts']['widget']]['inline_entity_form']['#entity'],
  ];
}