You are here

public function OrderConfigurationForm::submitForm in Vertical Tabs Config 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/OrderConfigurationForm.php, line 91

Class

OrderConfigurationForm
Configure order for this site.

Namespace

Drupal\vertical_tabs_config\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $values = $form_state
    ->getValues();
  $vertical_tabs = vertical_tabs_config_vertical_tab_list();
  foreach ($vertical_tabs as $vt_machine_name => $vt_human_name) {
    $new_value = $values['vttable']['vertical_tabs_config_' . $vt_machine_name]['weight'];
    $this
      ->config('vertical_tabs_config.order')
      ->set('vertical_tabs_config_' . $vt_machine_name, $new_value)
      ->save();
  }
  parent::submitForm($form, $form_state);
}