function ResolverRelationshipConfigure::validateForm

Same name in other branches
  1. 4.0.x src/Form/ResolverRelationshipConfigure.php \Drupal\ctools\Form\ResolverRelationshipConfigure::validateForm()

Configuration Form Validator.

Parameters

array $form: The Drupal Form.

\Drupal\Core\Form\FormStateInterface $form_state: The Form State.

Overrides FormBase::validateForm

File

src/Form/ResolverRelationshipConfigure.php, line 123

Class

ResolverRelationshipConfigure
Configure Relationships Resolver form.

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