function MediaSourceBase::submitConfigurationForm

Same name in other branches
  1. 8.9.x core/modules/media/src/MediaSourceBase.php \Drupal\media\MediaSourceBase::submitConfigurationForm()
  2. 10 core/modules/media/src/MediaSourceBase.php \Drupal\media\MediaSourceBase::submitConfigurationForm()
  3. 11.x core/modules/media/src/MediaSourceBase.php \Drupal\media\MediaSourceBase::submitConfigurationForm()

Overrides PluginFormInterface::submitConfigurationForm

1 call to MediaSourceBase::submitConfigurationForm()
OEmbed::submitConfigurationForm in core/modules/media/src/Plugin/media/Source/OEmbed.php
Form submission handler.
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();
    }
}

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