public function AddServices::submitForm in TacJS 8.3
Same name and namespace in other branches
- 8.6 src/Form/Steps/AddServices.php \Drupal\tacjs\Form\Steps\AddServices::submitForm()
- 8.4 src/Form/Steps/AddServices.php \Drupal\tacjs\Form\Steps\AddServices::submitForm()
- 8.5 src/Form/Steps/AddServices.php \Drupal\tacjs\Form\Steps\AddServices::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/ AddServices.php, line 120
Class
- AddServices
- Class AddServices.
Namespace
Drupal\tacjs\Form\StepsCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$content = $this
->getContent();
$config = $this
->config('tacjs.settings');
foreach ($this->content as $type => $services) {
foreach ($services as $service => $value) {
$config
->set('services.' . $service, $form_state
->getValue('service_' . $service));
if (preg_match_all('/tarteaucitron.user.([A-z]+)[\\s]+=[\\s]+[\\]?[\\"]?[\']?###([^.]+)###/m', $value['code']['js'] ?: (is_array($value['code']['html']) ? '' : $value['code']['html']), $match)) {
for ($i = 0; $i < count($match[1]); $i++) {
$config
->set('user.' . $match[1][$i], $form_state
->getValue('user_' . $match[1][$i]));
}
}
}
}
$config
->save();
parent::submitForm($form, $form_state);
}