You are here

public function MediaInlineForm::entityFormSubmit in Media entity 8

Handles the submission of an entity form.

Parameters

array $entity_form: The entity form.

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

Overrides EntityInlineForm::entityFormSubmit

File

src/Form/MediaInlineForm.php, line 42

Class

MediaInlineForm
Media inline form handler.

Namespace

Drupal\media_entity\Form

Code

public function entityFormSubmit(array &$entity_form, FormStateInterface $form_state) {
  parent::entityFormSubmit($entity_form, $form_state);

  /** @var \Drupal\media_entity\MediaInterface $entity */
  $entity = $entity_form['#entity'];

  // Make sure media thumbnail is set correctly.
  $entity
    ->automaticallySetThumbnail();
  if ($entity_form['#save_entity']) {
    $entity
      ->save();
  }
}