You are here

public function MediaSourceBase::submitConfigurationForm in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/media/src/MediaSourceBase.php \Drupal\media\MediaSourceBase::submitConfigurationForm()
  2. 9 core/modules/media/src/MediaSourceBase.php \Drupal\media\MediaSourceBase::submitConfigurationForm()
1 method overrides MediaSourceBase::submitConfigurationForm()
OEmbed::submitConfigurationForm in core/modules/media/src/Plugin/media/Source/OEmbed.php
Form submission handler.

File

core/modules/media/src/MediaSourceBase.php, line 216

Class

MediaSourceBase
Base implementation of media source plugin.

Namespace

Drupal\media

Code

public function submitConfigurationForm(array &$form, FormStateInterface $form_state) {
  foreach (array_intersect_key($form_state
    ->getValues(), $this->configuration) as $config_key => $config_value) {
    $this->configuration[$config_key] = $config_value;
  }

  // If no source field is explicitly set, create it now.
  if (empty($this->configuration['source_field'])) {
    $field_storage = $this
      ->createSourceFieldStorage();
    $field_storage
      ->save();
    $this->configuration['source_field'] = $field_storage
      ->getName();
  }
}