You are here

public function DatalayerSettingsForm::submitForm in dataLayer 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 ConfigFormBase::submitForm

File

src/Form/DatalayerSettingsForm.php, line 52

Class

DatalayerSettingsForm
Defines a form that configures datalayer module settings.

Namespace

Drupal\datalayer\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('datalayer.settings');
  $config
    ->set('add_page_meta', $form_state
    ->getValue('add_page_meta'))
    ->set('output_terms', $form_state
    ->getValue('output_terms'))
    ->set('output_fields', $form_state
    ->getValue('output_fields'))
    ->set('lib_helper', $form_state
    ->getValue('lib_helper'))
    ->set('entity_meta', $form_state
    ->getValue('global_entity_meta'))
    ->set('enable_ia', $form_state
    ->getValue('enable_ia'))
    ->set('ia_depth', $form_state
    ->getValue('ia_depth'))
    ->set('ia_category_primary', $form_state
    ->getValue('ia_category_primary'))
    ->set('ia_category_sub', $form_state
    ->getValue('ia_category_sub'))
    ->set('vocabs', $form_state
    ->getValue('vocabs'))
    ->set('expose_user_details', $form_state
    ->getValue('expose_user_details'))
    ->set('expose_user_details_roles', $form_state
    ->getValue('expose_user_details_roles'))
    ->set('current_user_meta', $form_state
    ->getValue('current_user_meta'))
    ->set('expose_user_details_fields', $form_state
    ->getValue('expose_user_details_fields'))
    ->set('entity_title', $form_state
    ->getValue('entity_title'))
    ->set('entity_type', $form_state
    ->getValue('entity_type'))
    ->set('entity_bundle', $form_state
    ->getValue('entity_bundle'))
    ->set('entity_identifier', $form_state
    ->getValue('entity_identifier'))
    ->set('drupal_language', $form_state
    ->getValue('drupal_language'))
    ->set('drupal_country', $form_state
    ->getValue('drupal_country'))
    ->set('site_name', $form_state
    ->getValue('site_name'))
    ->set('key_replacements', $this
    ->keyReplacementsToArray($form_state
    ->getValue('key_replacements')))
    ->save();
  if ($this->moduleHandler
    ->moduleExists('group')) {
    $config
      ->set('group', $form_state
      ->getValue('group'))
      ->set('group_label', $form_state
      ->getValue('group_label'))
      ->save();
  }
  parent::submitForm($form, $form_state);
}