You are here

public function ResolverRelationshipConfigure::validateForm in Chaos Tool Suite (ctools) 8.3

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/ResolverRelationshipConfigure.php, line 109

Class

ResolverRelationshipConfigure

Namespace

Drupal\ctools\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $machine_name = $form_state
    ->getValue('machine_name');
  $cached_values = $this->tempstore
    ->get($this->tempstore_id)
    ->get($this->machine_name);
  foreach ($this
    ->getContexts($cached_values) as $id => $context) {
    if ($context['machine_name'] == $machine_name) {
      $form_state
        ->setError($form['machine_name'], $this
        ->t('That machine name is in use by another context definition.'));
    }
  }
}