You are here

public function IefTest::submitForm in Inline Entity Form 8

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/inline_entity_form_test/src/IefTest.php, line 46

Class

IefTest
Tests Inline entity form element.

Namespace

Drupal\inline_entity_form_test

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $entity = $form['inline_entity_form']['#entity'];
  $message = $this
    ->t('Created @entity_type @label.', [
    '@entity_type' => $entity
      ->getEntityType()
      ->getLabel(),
    '@label' => $entity
      ->label(),
  ]);
  $this
    ->messenger()
    ->addMessage($message);
}