You are here

function ContentTranslateForm::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/content/src/Form/ContentTranslateForm.php, line 117

Class

ContentTranslateForm

Namespace

Drupal\tmgmt_content\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.'));
  }
}