public function SettingsForm::submitForm in Private files download permission 3.x
Same name and namespace in other branches
- 8.2 src/Form/SettingsForm.php \Drupal\pfdp\Form\SettingsForm::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/ SettingsForm.php, line 89
Class
- SettingsForm
- Settings form for private_files_download_permission.
Namespace
Drupal\pfdp\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$settings = \Drupal::configFactory()
->getEditable('pfdp.settings');
// Save all settings.
$settings
->set('by_user_checks', $form_state
->getValue('by_user_checks'))
->save();
if (!$form_state
->getValue('by_user_checks')) {
$settings
->set('cache_users', FALSE)
->save();
}
else {
$settings
->set('cache_users', $form_state
->getValue('cache_users'))
->save();
}
$settings
->set('attachment_mode', $form_state
->getValue('attachment_mode'))
->save();
$settings
->set('override_mode', $form_state
->getValue('override_mode'))
->save();
$settings
->set('debug_mode', $form_state
->getValue('debug_mode'))
->save();
// Display the status message.
\Drupal::messenger()
->addStatus($this
->t('Your settings were saved successfully.'));
}