public function SettingsForm::submitForm in Salesforce Suite 8.3
Same name in this branch
- 8.3 src/Form/SettingsForm.php \Drupal\salesforce\Form\SettingsForm::submitForm()
- 8.3 modules/salesforce_logger/src/Form/SettingsForm.php \Drupal\salesforce_logger\Form\SettingsForm::submitForm()
- 8.3 modules/salesforce_encrypt/src/Form/SettingsForm.php \Drupal\salesforce_encrypt\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 FormInterface::submitForm
File
- modules/
salesforce_encrypt/ src/ Form/ SettingsForm.php, line 104
Class
- SettingsForm
- Base form for key add and edit forms.
Namespace
Drupal\salesforce_encrypt\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
$old_profile_id = $this->state
->get('salesforce_encrypt.profile');
$profile_id = $form_state
->getValue('profile');
if ($old_profile_id == $profile_id) {
// No change to encryption profile. Do nothing.
return;
}
$profile = $this->encryptionProfileManager
->getEncryptionProfile($profile_id);
if (empty($profile_id)) {
// New profile id empty: disable encryption.
$this->client
->disableEncryption();
}
elseif (empty($old_profile_id)) {
// Old profile id empty: enable encryption anew.
$this->client
->enableEncryption($profile);
}
else {
// Changing encryption profiles: disable, then re-enable.
$this->client
->disableEncryption();
$this->client
->enableEncryption($profile);
}
$this->state
->resetCache();
drupal_set_message($this
->t('The configuration options have been saved.'));
}