public function PopupMessageSettingsForm::submitForm in Popup message 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/ PopupMessageSettingsForm.php, line 253
Class
- PopupMessageSettingsForm
- Class PopupMessageSettingsForm.
Namespace
Drupal\popup_message\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this
->config('popup_message.settings');
$flush_cache = $config
->get('style') == $form_state
->getValue('popup_message_enable') ? FALSE : TRUE;
$flush_cache_css = $config
->get('style') == $form_state
->getValue('popup_message_style') ? FALSE : TRUE;
$flush_cache_js = $config
->get('style') == $form_state
->getValue('popup_message_check_cookie') ? FALSE : TRUE;
$text = $form_state
->getValue('popup_message_body')['value'];
$uuids = $this
->extractFilesUuid($text);
$this
->recordFileUsage($uuids);
$config
->set('enable', $form_state
->getValue('popup_message_enable'))
->set('title', $form_state
->getValue('popup_message_title'))
->set('body', $form_state
->getValue('popup_message_body'))
->set('height', $form_state
->getValue('popup_message_height'))
->set('width', $form_state
->getValue('popup_message_width'))
->set('check_cookie', $form_state
->getValue('popup_message_check_cookie'))
->set('expire', $form_state
->getValue('popup_message_expire'))
->set('delay', $form_state
->getValue('popup_message_delay'))
->set('close_delay', $form_state
->getValue('popup_message_close_delay'))
->set('cover_opacity', $form_state
->getValue('popup_message_cover_opacity'))
->set('style', $form_state
->getValue('popup_message_style'))
->set('visibility', $form_state
->getValue('popup_message_visibility'))
->set('visibility_pages', $form_state
->getValue('popup_message_visibility_pages'))
->save();
if ($flush_cache) {
drupal_flush_all_caches();
}
if ($flush_cache_css) {
$this->cssOptimizer
->deleteAll();
}
if ($flush_cache_js) {
$this->jsOptimizer
->deleteAll();
}
parent::submitForm($form, $form_state);
}