public function SettingsForm::settingsSubmitForm in Opigno Moxtra 3.x
Same name and namespace in other branches
- 8 src/Form/SettingsForm.php \Drupal\opigno_moxtra\Form\SettingsForm::settingsSubmitForm()
File
- src/
Form/ SettingsForm.php, line 254
Class
- SettingsForm
- Implements the Opigno Moxtra settings form.
Namespace
Drupal\opigno_moxtra\FormCode
public function settingsSubmitForm(array &$form, FormStateInterface $form_state) {
parent::submitForm($form, $form_state);
$config = \Drupal::configFactory()
->getEditable('opigno_moxtra.settings');
$config
->setData([]);
$config
->save();
$connector = \Drupal::service('opigno_moxtra.connector');
$token = $connector
->getToken(1, TRUE);
$this
->config('opigno_moxtra.settings')
->set('url', $form_state
->getValue('moxtra_url'))
->set('client_id', $form_state
->getValue('client_id'))
->set('client_secret', $form_state
->getValue('client_secret'))
->set('email', $form_state
->getValue('moxtra_login'))
->set('org_id', $form_state
->getValue('org_id'))
->set('agreement', $form_state
->getValue('agreement'))
->set('status', !empty($token))
->save();
$prefix = $this->keyValueStorage
->get('prefix');
if (empty($prefix)) {
$prefix = $this->request
->getCurrentRequest()
->getHost();
$this->keyValueStorage
->set('prefix', $prefix);
}
}