You are here

public function FormElementTest::submitForm in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 tests/modules/entity_browser_test/src/Form/FormElementTest.php \Drupal\entity_browser_test\Form\FormElementTest::submitForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

tests/modules/entity_browser_test/src/Form/FormElementTest.php, line 52

Class

FormElementTest
Provides a user login form.

Namespace

Drupal\entity_browser_test\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $entities = $form_state
    ->getValue([
    'fancy_entity_browser',
    'entities',
  ]);
  $message = 'Selected entities: ';
  $message .= implode(', ', array_map(function (EntityInterface $item) {
    return $item
      ->label();
  }, $entities));
  $this
    ->messenger()
    ->addMessage($message);
}