You are here

public function JwplayerSettingsForm::submitForm in JW Player 8

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

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

Overrides ConfigFormBase::submitForm

File

src/Form/JwplayerSettingsForm.php, line 135

Class

JwplayerSettingsForm
Configure search settings for this site.

Namespace

Drupal\jw_player\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $config = $this
    ->config('jw_player.settings');
  if ($form_state
    ->getValue('jw_player_hosting') == 'self') {
    $config
      ->set('jw_player_key', $form_state
      ->getValue('jw_player_key'));
    $config
      ->clear('cloud_player_library_url');
  }
  else {
    $config
      ->set('cloud_player_library_url', $form_state
      ->getValue('cloud_player_library_url'));
    $config
      ->clear('jw_player_key');
  }
  $config
    ->set('jw_player_version', $form_state
    ->getValue('jw_player_version'));
  $config
    ->save();
}