You are here

public function SalesforceAuthSettings::submitForm in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 5.0.x src/Form/SalesforceAuthSettings.php \Drupal\salesforce\Form\SalesforceAuthSettings::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/SalesforceAuthSettings.php, line 104

Class

SalesforceAuthSettings
Class SalesforceAuthSettings.

Namespace

Drupal\salesforce\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->config('salesforce.settings')
    ->set('salesforce_auth_provider', $form_state
    ->getValue('provider') ? $form_state
    ->getValue('provider') : NULL)
    ->save();
  $this
    ->messenger()
    ->addStatus($this
    ->t('Authorization settings have been saved.'));
  $this->eventDispatcher
    ->dispatch(SalesforceEvents::NOTICE, new SalesforceNoticeEvent(NULL, "Authorization provider changed to %provider.", [
    '%provider' => $form_state
      ->getValue('provider'),
  ]));
}