You are here

public function ShortenAdminForm::submitForm in Shorten URLs 8

Same name and namespace in other branches
  1. 8.2 src/Form/ShortenAdminForm.php \Drupal\shorten\Form\ShortenAdminForm::submitForm()

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/ShortenAdminForm.php, line 182

Class

ShortenAdminForm
Settings form.

Namespace

Drupal\shorten\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();
  $this
    ->config('shorten.settings')
    ->set('shorten_www', $values['shorten_www'])
    ->set('shorten_method', $values['shorten_method'])
    ->set('shorten_service', $values['shorten_service'])
    ->set('shorten_service_backup', $values['shorten_service_backup'])
    ->set('shorten_show_service', $values['shorten_show_service'])
    ->set('shorten_use_alias', $values['shorten_use_alias'])
    ->set('shorten_timeout', $values['shorten_timeout'])
    ->set('shorten_cache_duration', $values['shorten_cache_duration'])
    ->set('shorten_cache_fail_duration', $values['shorten_cache_fail_duration'])
    ->set('shorten_cache_clear_all', $values['shorten_cache_clear_all'])
    ->set('shorten_invisible_services', serialize($values['shorten_invisible_services']))
    ->save();

  // Changed settings usually mean that different URLs should be used.
  // cache_clear_all('*', 'cache_shorten', TRUE);
}