You are here

public function Settings::submitForm in Drupal OAuth & OpenID Connect Login - OAuth2 Client SSO 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 212

Class

Settings

Namespace

Drupal\miniorange_oauth_client\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $baseUrlvalue = trim($form['markup_custom_role_mapping']['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('miniorange_oauth_client.settings')
    ->set('miniorange_oauth_client_base_url', $baseUrlvalue)
    ->save();
  \Drupal::messenger()
    ->addMessage(t('Configurations saved successfully.'));
}