You are here

public function MatcherForm::validateForm in CRM Core 8

Same name and namespace in other branches
  1. 8.3 modules/crm_core_match/src/Form/MatcherForm.php \Drupal\crm_core_match\Form\MatcherForm::validateForm()
  2. 8.2 modules/crm_core_match/src/Form/MatcherForm.php \Drupal\crm_core_match\Form\MatcherForm::validateForm()

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

modules/crm_core_match/src/Form/MatcherForm.php, line 143

Class

MatcherForm
Provides a form elements for Matcher.

Namespace

Drupal\crm_core_match\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);

  /** @var \Drupal\crm_core_match\Matcher\MatcherConfigInterface $matcher */
  $matcher = $this->entity;

  /** @var \Drupal\crm_core_match\Plugin\crm_core_match\engine\MatchEngineInterface $plugin */
  if ($matcher
    ->isNew()) {
    $plugin_id = $form_state
      ->getValue('plugin_id');
    $plugin = crm_core_match_matcher_manager()
      ->createInstance($plugin_id, $matcher
      ->getConfiguration());
  }
  else {
    $plugin = $matcher
      ->getPlugin();
  }
  $plugin
    ->validateConfigurationForm($form, $form_state);
}