public function BlazySettingsForm::submitForm in Blazy 7
Same name and namespace in other branches
- 8.2 blazy_ui/src/Form/BlazySettingsForm.php \Drupal\blazy_ui\Form\BlazySettingsForm::submitForm()
- 8 blazy_ui/src/Form/BlazySettingsForm.php \Drupal\blazy_ui\Form\BlazySettingsForm::submitForm()
Implements \Drupal\Core\Form\FormInterface::submitForm().
File
- modules/
blazy_ui/ src/ Form/ BlazySettingsForm.php, line 209
Class
- BlazySettingsForm
- Defines blazy admin settings form.
Namespace
Drupal\blazy_ui\FormCode
public function submitForm($form, &$form_state) {
$defaults = BlazyDefault::formSettings();
$data = [];
// Always run typecasting on submit.
$this->manager
->typecast($form_state['values'], 'blazy.settings', TRUE);
foreach ($defaults as $key => $value) {
if (isset($form_state['values'][$key])) {
$data[$key] = $form_state['values'][$key];
}
}
// Merge all separate variables into blazy.settings for simplicity.
variable_set('blazy.settings', array_merge((array) $this->manager
->config(), $data));
// Safe to remove old array since already merged above.
foreach ($defaults as $key => $value) {
if (isset($form_state['values'][$key])) {
unset($form_state['values'][$key]);
}
}
}