function ConfigTranslationDeleteForm::submitForm

Same name in other branches
  1. 8.9.x core/modules/config_translation/src/Form/ConfigTranslationDeleteForm.php \Drupal\config_translation\Form\ConfigTranslationDeleteForm::submitForm()
  2. 10 core/modules/config_translation/src/Form/ConfigTranslationDeleteForm.php \Drupal\config_translation\Form\ConfigTranslationDeleteForm::submitForm()
  3. 11.x core/modules/config_translation/src/Form/ConfigTranslationDeleteForm.php \Drupal\config_translation\Form\ConfigTranslationDeleteForm::submitForm()

Overrides FormInterface::submitForm

File

core/modules/config_translation/src/Form/ConfigTranslationDeleteForm.php, line 134

Class

ConfigTranslationDeleteForm
Builds a form to delete configuration translation.

Namespace

Drupal\config_translation\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    foreach ($this->mapper
        ->getConfigNames() as $name) {
        $this->languageManager
            ->getLanguageConfigOverride($this->language
            ->getId(), $name)
            ->delete();
    }
    // Flush all persistent caches.
    $this->moduleHandler
        ->invokeAll('cache_flush');
    foreach (Cache::getBins() as $cache_backend) {
        $cache_backend->deleteAll();
    }
    $this->messenger()
        ->addStatus($this->t('@language translation of %label was deleted', [
        '%label' => $this->mapper
            ->getTitle(),
        '@language' => $this->language
            ->getName(),
    ]));
    $form_state->setRedirectUrl($this->getCancelUrl());
}

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