public function EditTexts::submitForm in TacJS 8.6
Same name and namespace in other branches
- 8.2 src/Form/Steps/EditTexts.php \Drupal\tacjs\Form\Steps\EditTexts::submitForm()
- 8.3 src/Form/Steps/EditTexts.php \Drupal\tacjs\Form\Steps\EditTexts::submitForm()
- 8.4 src/Form/Steps/EditTexts.php \Drupal\tacjs\Form\Steps\EditTexts::submitForm()
- 8.5 src/Form/Steps/EditTexts.php \Drupal\tacjs\Form\Steps\EditTexts::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/ Steps/ EditTexts.php, line 406
Class
- EditTexts
- Class EditTexts.
Namespace
Drupal\tacjs\Form\StepsCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$config = $this
->config('tacjs.settings');
$elements = [
'middleBarHead' => 'middleBarHead',
'adblock' => 'adblock',
'adblock_call' => 'adblock_call',
'reload' => 'reload',
'alertBigScroll' => 'alertBigScroll',
'alertBigClick' => 'alertBigClick',
'alertBig' => 'alertBig',
'alertBigPrivacy' => 'alertBigPrivacy',
'alertSmall' => 'alertSmall',
'personalize' => 'personalize',
'acceptAll' => 'acceptAll',
'close' => 'close',
'privacyUrl' => 'privacyUrl',
'all' => 'all',
'info' => 'info',
'disclaimer' => 'disclaimer',
'allow' => 'allow',
'deny' => 'deny',
'noCookie' => 'noCookie',
'useCookie' => 'useCookie',
'useCookieCurrent' => 'useCookieCurrent',
'useNoCookie' => 'useNoCookie',
'more' => 'more',
'source' => 'source',
'credit' => 'credit',
'noServices' => 'noServices',
'toggleInfoBox' => 'toggleInfoBox',
'title' => 'title',
'cookieDetail' => 'cookieDetail',
'ourSite' => 'ourSite',
'newWindow' => 'newWindow',
'allowAll' => 'allowAll',
'denyAll' => 'denyAll',
'fallback' => 'fallback',
'ads.title' => 'ads_title',
'ads.details' => 'ads_details',
'analytic.title' => 'analytic_title',
'analytic.details' => 'analytic_details',
'social.title' => 'social_title',
'social.details' => 'social_details',
'video.title' => 'video_title',
'video.details' => 'video_details',
'comment.title' => 'comment_title',
'comment.details' => 'comment_details',
'support.title' => 'support_title',
'support.details' => 'support_details',
'api.title' => 'api_title',
'api.details' => 'api_details',
'other.title' => 'other_title',
'other.details' => 'other_details',
'mandatoryTitle' => 'mandatoryTitle',
'mandatoryText' => 'mandatoryText',
];
foreach ($elements as $key => $element) {
if ($form_state
->getValue($element)) {
$config
->set('texts.' . $key, $form_state
->getValue($element));
}
else {
$config
->clear('texts.' . $key);
}
}
$config
->save();
parent::submitForm($form, $form_state);
}