function VocabularyResetForm::submitForm

Same name and namespace in other branches
  1. 9 core/modules/taxonomy/src/Form/VocabularyResetForm.php \Drupal\taxonomy\Form\VocabularyResetForm::submitForm()
  2. 8.9.x core/modules/taxonomy/src/Form/VocabularyResetForm.php \Drupal\taxonomy\Form\VocabularyResetForm::submitForm()
  3. 10 core/modules/taxonomy/src/Form/VocabularyResetForm.php \Drupal\taxonomy\Form\VocabularyResetForm::submitForm()

Overrides EntityForm::submitForm

File

core/modules/taxonomy/src/Form/VocabularyResetForm.php, line 81

Class

VocabularyResetForm
Provides confirmation form for resetting a vocabulary to alphabetical order.

Namespace

Drupal\taxonomy\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    parent::submitForm($form, $form_state);
    $this->termStorage
        ->resetWeights($this->entity
        ->id());
    $this->messenger()
        ->addStatus($this->t('Reset vocabulary %name to alphabetical order.', [
        '%name' => $this->entity
            ->label(),
    ]));
    $this->logger('taxonomy')
        ->notice('Reset vocabulary %name to alphabetical order.', [
        '%name' => $this->entity
            ->label(),
    ]);
    $form_state->setRedirectUrl($this->getCancelUrl());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.