function ContextConfigure::validateForm
Same name in other branches
- 8.x-3.x src/Form/ContextConfigure.php \Drupal\ctools\Form\ContextConfigure::validateForm()
Overrides FormBase::validateForm
File
-
src/
Form/ ContextConfigure.php, line 171
Class
- ContextConfigure
- Configure Context Form.
Namespace
Drupal\ctools\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
// If these are not equal, then we're adding a new context and should not override an existing context.
if ($form_state->getValue('machine_name') != $form_state->getValue('context_id')) {
$machine_name = $form_state->getValue('machine_name');
$cached_values = $this->tempstore
->get($this->tempstore_id)
->get($this->machine_name);
if (!empty($this->getContexts($cached_values)[$machine_name])) {
$form_state->setError($form['machine_name'], $this->t('That machine name is in use by another context definition.'));
}
}
}