You are here

public function PrevNextConfigForm::submitForm in Previous/Next API 8.2

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/PrevNextConfigForm.php, line 104

Class

PrevNextConfigForm
Class PrevNextConfigForm.

Namespace

Drupal\prev_next\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->config('prev_next.settings')
    ->set('batch_size', $form_state
    ->getValue('batch_size'))
    ->save();

  // Save Node types settings.
  foreach ($form_state
    ->getValue('node_type') as $bundle => $values) {
    $bundle_config = \Drupal::configFactory()
      ->getEditable('prev_next.node_type.' . $bundle);
    $bundle_config
      ->set('include', $values['include'])
      ->set('current', $values['current'])
      ->set('indexing_criteria', $values['indexing_criteria'])
      ->set('indexing_criteria_current', $values['indexing_criteria_current'])
      ->set('same_type', $values['same_type'])
      ->set('same_type_current', $values['same_type_current'])
      ->save();
  }
  parent::submitForm($form, $form_state);
}