function TranslateFilterForm::submitForm

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

Overrides FormInterface::submitForm

File

core/modules/locale/src/Form/TranslateFilterForm.php, line 85

Class

TranslateFilterForm
Provides a filtered translation edit form.

Namespace

Drupal\locale\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
    $filters = $this->translateFilters();
    $session_filters = $this->getRequest()
        ->getSession()
        ->get('locale_translate_filter', []);
    foreach ($filters as $name => $filter) {
        if ($form_state->hasValue($name)) {
            $session_filters[$name] = trim($form_state->getValue($name));
        }
    }
    $this->getRequest()
        ->getSession()
        ->set('locale_translate_filter', $session_filters);
    $form_state->setRedirect('locale.translate_page');
}

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