You are here

public function AdminSettingsForm::submitForm in Tipsy 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/AdminSettingsForm.php, line 256

Class

AdminSettingsForm
Class AdminSettingsForm.

Namespace

Drupal\tipsy\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();
  $options_count = $this->configFactory
    ->get("total_options");
  $wide_settings = [
    'drupal_forms' => [
      'forms' => $values['drupal_forms']['forms'],
      'options' => $values['drupal_forms']['wrapper']['options'],
    ],
    'custom_selectors' => [],
  ];
  for ($i = 0; $i <= $options_count; $i++) {
    $wide_settings['custom_selectors'][$i] = $values['custom_selectors'][$i];
  }
  $this->configFactory
    ->set('wide_settings', $wide_settings)
    ->save();
  parent::submitForm($form, $form_state);
}