You are here

public function SettingsForm::submitForm in Salesforce Suite 8.3

Same name in this branch
  1. 8.3 src/Form/SettingsForm.php \Drupal\salesforce\Form\SettingsForm::submitForm()
  2. 8.3 modules/salesforce_logger/src/Form/SettingsForm.php \Drupal\salesforce_logger\Form\SettingsForm::submitForm()
  3. 8.3 modules/salesforce_encrypt/src/Form/SettingsForm.php \Drupal\salesforce_encrypt\Form\SettingsForm::submitForm()
Same name and namespace in other branches
  1. 8.4 src/Form/SettingsForm.php \Drupal\salesforce\Form\SettingsForm::submitForm()
  2. 5.0.x src/Form/SettingsForm.php \Drupal\salesforce\Form\SettingsForm::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/SettingsForm.php, line 213

Class

SettingsForm
Creates authorization form for Salesforce.

Namespace

Drupal\salesforce\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('salesforce.settings');
  $config
    ->set('show_all_objects', $form_state
    ->getValue('show_all_objects'));
  $config
    ->set('standalone', $form_state
    ->getValue('standalone'));
  $config
    ->set('global_push_limit', $form_state
    ->getValue('global_push_limit'));
  $config
    ->set('pull_max_queue_size', $form_state
    ->getValue('pull_max_queue_size'));
  $config
    ->set('limit_mapped_object_revisions', $form_state
    ->getValue('limit_mapped_object_revisions'));
  $config
    ->set('endpoint_verification', $form_state
    ->getValue('endpoint_verification'));
  $use_latest = $form_state
    ->getValue('use_latest');
  $config
    ->set('use_latest', $use_latest);
  if (!$use_latest) {
    $versions = $this->client
      ->getVersions();
    $version = $versions[$form_state
      ->getValue('rest_api_version')];
    $config
      ->set('rest_api_version', $version);
  }
  $config
    ->save();
  parent::submitForm($form, $form_state);
}