public function PcaAddressSettingsForm::submitForm in Loqate 8
Same name and namespace in other branches
- 2.x src/Form/PcaAddressSettingsForm.php \Drupal\loqate\Form\PcaAddressSettingsForm::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/ PcaAddressSettingsForm.php, line 146
Class
- PcaAddressSettingsForm
- Class PcaAddressSettingsForm.
Namespace
Drupal\loqate\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$values = $form_state
->getValue(self::PCA_FIELDS);
$field_mapping = [];
foreach ($values as $i => $value) {
if ((bool) $value['enabled']['data'] === FALSE) {
continue;
}
$field_mapping[] = [
'element' => $i,
'field' => $value['field']['data'],
'mode' => (int) $value['mode']['data'],
];
}
$this
->config('loqate.settings')
->set(self::PCA_FIELDS, $field_mapping)
->save();
parent::submitForm($form, $form_state);
}