You are here

function ConfigTranslateForm::validateForm in Translation Management Tool 8

Form validation 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 FormBase::validateForm

File

sources/tmgmt_config/src/Form/ConfigTranslateForm.php, line 179

Class

ConfigTranslateForm
Configuration translation overview form.

Namespace

Drupal\tmgmt_config\Form

Code

function validateForm(array &$form, FormStateInterface $form_state) {
  $selected = array_filter($form_state
    ->getValue('languages'));
  if (empty($selected)) {
    $form_state
      ->setErrorByName('languages', $this
      ->t('You have to select at least one language for requesting a translation.'));
  }
}