You are here

public function ResetSettingsForm::submitForm in Pager Serializer 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 FormInterface::submitForm

File

src/Form/ResetSettingsForm.php, line 32

Class

ResetSettingsForm
Defines a confirmation form to confirm deletion of something by id.

Namespace

Drupal\pager_serializer\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  \Drupal::service('config.factory')
    ->getEditable(static::SETTINGS)
    ->set('rows_label', 'rows')
    ->set('pager_label', 'pager')
    ->set('pager_object_enabled', TRUE)
    ->set('current_page_enabled', TRUE)
    ->set('current_page_label', 'current_page')
    ->set('total_items_enabled', TRUE)
    ->set('total_items_label', 'total_items')
    ->set('total_pages_enabled', TRUE)
    ->set('total_pages_label', 'total_pages')
    ->set('items_per_page_enabled', TRUE)
    ->set('items_per_page_label', 'items_per_page')
    ->save();
  $url = Url::fromRoute('pager_serializer.settings');
  $form_state
    ->setRedirectUrl($url);
}