You are here

public function TranslatorForm::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

src/Form/TranslatorForm.php, line 230

Class

TranslatorForm
Form controller for the translator edit forms.

Namespace

Drupal\tmgmt\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);
  if (!$form_state
    ->getValue('plugin')) {
    $form_state
      ->setErrorByName('plugin', $this
      ->t('You have to select a translator plugin.'));
  }
  $plugin_ui = $this->translatorManager
    ->createUIInstance($this->entity
    ->getPluginID());
  $plugin_ui
    ->validateConfigurationForm($form, $form_state);
}