public function FillPdfSettingsForm::submitForm in FillPDF 5.0.x
Same name and namespace in other branches
- 8.4 src/Form/FillPdfSettingsForm.php \Drupal\fillpdf\Form\FillPdfSettingsForm::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/ FillPdfSettingsForm.php, line 382
Class
- FillPdfSettingsForm
- Configure FillPDF settings form.
Namespace
Drupal\fillpdf\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
// Save form values.
$values = $form_state
->getValues();
$config = $this
->config('fillpdf.settings');
$config
->set('allowed_schemes', array_keys(array_filter($values['allowed_schemes'])))
->set('template_scheme', $values['template_scheme'])
->set('backend', $values['backend']);
switch ($values['backend']) {
case 'fillpdf_service':
$config
->set('remote_endpoint', $values['remote_endpoint'])
->set('fillpdf_service_api_key', $values['fillpdf_service_api_key'])
->set('remote_protocol', $values['remote_protocol']);
break;
case 'local_service':
$config
->set('local_service_endpoint', $values['local_service_endpoint']);
break;
case 'pdftk':
$config
->set('pdftk_path', $form_state
->getValue('pdftk_path'))
->set('shell_locale', $values['shell_locale']);
break;
}
$config
->save();
parent::submitForm($form, $form_state);
}