function TermForm::flagViolations
Same name in other branches
- 8.9.x core/modules/taxonomy/src/TermForm.php \Drupal\taxonomy\TermForm::flagViolations()
- 10 core/modules/taxonomy/src/TermForm.php \Drupal\taxonomy\TermForm::flagViolations()
- 11.x core/modules/taxonomy/src/TermForm.php \Drupal\taxonomy\TermForm::flagViolations()
Overrides ContentEntityForm::flagViolations
File
-
core/
modules/ taxonomy/ src/ TermForm.php, line 170
Class
- TermForm
- Base for handler for taxonomy term edit forms.
Namespace
Drupal\taxonomyCode
protected function flagViolations(EntityConstraintViolationListInterface $violations, array $form, FormStateInterface $form_state) {
// Manually flag violations of fields not handled by the form display. This
// is necessary as entity form displays only flag violations for fields
// contained in the display.
// @see ::form()
foreach ($violations->getByField('parent') as $violation) {
$form_state->setErrorByName('parent', $violation->getMessage());
}
foreach ($violations->getByField('weight') as $violation) {
$form_state->setErrorByName('weight', $violation->getMessage());
}
parent::flagViolations($violations, $form, $form_state);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.