You are here

public function AdminSettingsForm::submitForm in Acquia Lift Connector 8.4

Same name and namespace in other branches
  1. 8 src/Form/AdminSettingsForm.php \Drupal\acquia_lift\Form\AdminSettingsForm::submitForm()
  2. 8.3 src/Form/AdminSettingsForm.php \Drupal\acquia_lift\Form\AdminSettingsForm::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/AdminSettingsForm.php, line 442

Class

AdminSettingsForm
Defines a form that configures settings.

Namespace

Drupal\acquia_lift\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $settings = $this
    ->config('acquia_lift.settings');
  $values = $form_state
    ->getValues();
  $this
    ->setCredentialValues($settings, $values['credential']);
  $this
    ->setIdentityValues($settings, $values['identity']);
  $this
    ->setFieldMappingsValues($settings, $values['field_mappings']);
  $this
    ->setUdfMappingsValues($settings, $values['udf_person_mappings'], 'person');
  $this
    ->setUdfMappingsValues($settings, $values['udf_event_mappings'], 'event');
  $this
    ->setUdfMappingsValues($settings, $values['udf_touch_mappings'], 'touch');
  $this
    ->setVisibilityValues($settings, $values['visibility']);
  $this
    ->setAdvancedValues($settings, $values['advanced']);
  $settings
    ->save();

  // It is required to flush all caches on save. This is because many settings
  // here impact page caches and their invalidation strategies.
  drupal_flush_all_caches();
  parent::submitForm($form, $form_state);
}