You are here

public function NestedEntityTestForm::submitForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/field/tests/modules/field_test/src/Form/NestedEntityTestForm.php \Drupal\field_test\Form\NestedEntityTestForm::submitForm()

{@inheritdoc]

Overrides FormInterface::submitForm

File

core/modules/field/tests/modules/field_test/src/Form/NestedEntityTestForm.php, line 80
Contains \Drupal\field_test\Form\NestedEntityTestForm.

Class

NestedEntityTestForm
Provides a form for field_test routes.

Namespace

Drupal\field_test\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  /** @var \Drupal\Core\Entity\EntityInterface $entity_1 */
  $entity_1 = $form_state
    ->get('entity_1');
  $entity_1
    ->save();

  /** @var \Drupal\Core\Entity\EntityInterface $entity_2 */
  $entity_2 = $form_state
    ->get('entity_2');
  $entity_2
    ->save();
  drupal_set_message($this
    ->t('test_entities @id_1 and @id_2 have been updated.', array(
    '@id_1' => $entity_1
      ->id(),
    '@id_2' => $entity_2
      ->id(),
  )));
}