public function SettingsForm::submitForm in Advanced Page Expiration 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/ SettingsForm.php, line 170
Class
Namespace
Drupal\ape\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$this->excluded
->setConfig('pages', $form_state
->getValue([
'page_caching',
'pages',
]));
$this->alternatives
->setConfig('pages', $form_state
->getValue([
'page_caching_alternative',
'pages',
]));
$this
->config('system.performance')
->set('cache.page.max_age', $form_state
->getValue([
'page_caching',
'page_cache_maximum_age',
]))
->save();
$this
->config('ape.settings')
->set('alternatives', $this->alternatives
->getConfig()['pages'])
->set('exclusions', $this->excluded
->getConfig()['pages'])
->set('lifetime.alternatives', $form_state
->getValue([
'page_caching_alternative',
'ape_alternative_lifetime',
]))
->set('lifetime.301', $form_state
->getValue([
'server_codes',
'ape_301_lifetime',
]))
->set('lifetime.302', $form_state
->getValue([
'server_codes',
'ape_302_lifetime',
]))
->set('lifetime.404', $form_state
->getValue([
'server_codes',
'ape_404_lifetime',
]))
->save();
parent::submitForm($form, $form_state);
}