public function StripeSettingsForm::submitForm in Stripe 8
Same name and namespace in other branches
- 2.x src/Form/StripeSettingsForm.php \Drupal\stripe\Form\StripeSettingsForm::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/ StripeSettingsForm.php, line 103
Class
- StripeSettingsForm
- Class StripeConfig.
Namespace
Drupal\stripe\FormCode
public function submitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$config = $this
->config('stripe.settings');
$secret = $form_state
->getValue('apikey_secret_test');
if ($secret) {
$config
->set('apikey.test.secret', $secret);
}
$secret = $form_state
->getValue('apikey_secret_live');
if ($secret) {
$config
->set('apikey.live.secret', $secret);
}
$secret = $form_state
->getValue('apikey_webhook_test');
if ($secret) {
$config
->set('apikey.test.webhook', $secret);
}
$secret = $form_state
->getValue('apikey_webhook_live');
if ($secret) {
$config
->set('apikey.live.webhook', $secret);
}
$this
->config('stripe.settings')
->set('apikey.test.public', $form_state
->getValue('apikey_public_test'))
->set('apikey.live.public', $form_state
->getValue('apikey_public_live'))
->set('environment', $form_state
->getValue('environment'))
->save();
}