public function Settings::submitForm in OAuth2 Login 8
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
- src/
Form/ Settings.php, line 125
Class
Namespace
Drupal\oauth2_login\FormCode
public function submitForm(array &$form, \Drupal\Core\Form\FormStateInterface $form_state) {
$baseUrlvalue = trim($form['miniorange_oauth_client_base_url']['#value']);
if (!empty($baseUrlvalue) && filter_var($baseUrlvalue, FILTER_VALIDATE_URL) == FALSE) {
\Drupal::messenger()
->adderror(t('Please enter a valid URL'));
return;
}
\Drupal::configFactory()
->getEditable('oauth2_login.settings')
->set('miniorange_oauth_client_base_url', $baseUrlvalue)
->save();
\Drupal::messenger()
->addMessage(t('Configurations saved successfully.'));
}