function MediaTypeForm::submitForm

Same name in other branches
  1. 9 core/modules/media/src/MediaTypeForm.php \Drupal\media\MediaTypeForm::submitForm()
  2. 10 core/modules/media/src/MediaTypeForm.php \Drupal\media\MediaTypeForm::submitForm()
  3. 11.x core/modules/media/src/MediaTypeForm.php \Drupal\media\MediaTypeForm::submitForm()

Overrides EntityForm::submitForm

File

core/modules/media/src/MediaTypeForm.php, line 294

Class

MediaTypeForm
Form controller for media type forms.

Namespace

Drupal\media

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    $form_state->setValue('field_map', array_filter($form_state->getValue('field_map', []), function ($item) {
        return $item != MediaSourceInterface::METADATA_FIELD_EMPTY;
    }));
    parent::submitForm($form, $form_state);
    $this->entity
        ->setQueueThumbnailDownloadsStatus((bool) $form_state->getValue([
        'options',
        'queue_thumbnail_downloads',
    ]))
        ->setStatus((bool) $form_state->getValue([
        'options',
        'status',
    ]))
        ->setNewRevision((bool) $form_state->getValue([
        'options',
        'new_revision',
    ]));
    if (isset($form['source_dependent']['source_configuration'])) {
        // Let the selected plugin save its settings.
        $this->entity
            ->getSource()
            ->submitConfigurationForm($form['source_dependent']['source_configuration'], $this->getSourceSubFormState($form, $form_state));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.