function TermForm::validateForm
Same name in other branches
- 9 core/modules/taxonomy/src/TermForm.php \Drupal\taxonomy\TermForm::validateForm()
- 10 core/modules/taxonomy/src/TermForm.php \Drupal\taxonomy\TermForm::validateForm()
- 11.x core/modules/taxonomy/src/TermForm.php \Drupal\taxonomy\TermForm::validateForm()
Overrides ContentEntityForm::validateForm
File
-
core/
modules/ taxonomy/ src/ TermForm.php, line 101
Class
- TermForm
- Base for handler for taxonomy term edit forms.
Namespace
Drupal\taxonomyCode
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
// Ensure numeric values.
if ($form_state->hasValue('weight') && !is_numeric($form_state->getValue('weight'))) {
$form_state->setErrorByName('weight', $this->t('Weight value must be numeric.'));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.