You are here

public function FileMetadataPluginBase::submitConfigurationForm in File metadata manager 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/FileMetadata/FileMetadataPluginBase.php \Drupal\file_mdm\Plugin\FileMetadata\FileMetadataPluginBase::submitConfigurationForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the plugin form as built by static::buildConfigurationForm().

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form. Calling code should pass on a subform state created through \Drupal\Core\Form\SubformState::createForSubform().

Overrides PluginFormInterface::submitConfigurationForm

File

src/Plugin/FileMetadata/FileMetadataPluginBase.php, line 189

Class

FileMetadataPluginBase
Abstract implementation of a base File Metadata plugin.

Namespace

Drupal\file_mdm\Plugin\FileMetadata

Code

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

  // @codingStandardsIgnoreStart
  $this->configuration['cache']['override'] = (bool) $form_state
    ->getValue([
    $this
      ->getPluginId(),
    'override',
  ]);
  $this->configuration['cache']['settings'] = $form_state
    ->getValue([
    $this
      ->getPluginId(),
    'cache_details',
    'settings',
  ]);

  // @codingStandardsIgnoreEnd
  $config = $this
    ->getConfigObject(TRUE);
  $config
    ->set('configuration', $this->configuration);
  if ($config
    ->getOriginal('configuration') != $config
    ->get('configuration')) {
    $config
      ->save();
  }
}