function TermForm::buildEntity
Same name and namespace in other branches
- 11.x core/modules/taxonomy/src/TermForm.php \Drupal\taxonomy\TermForm::buildEntity()
- 10 core/modules/taxonomy/src/TermForm.php \Drupal\taxonomy\TermForm::buildEntity()
File
-
core/
modules/ taxonomy/ src/ TermForm.php, line 148
Class
- TermForm
- Base for handler for taxonomy term edit forms.
Namespace
Drupal\taxonomyCode
public function buildEntity(array $form, FormStateInterface $form_state) {
$term = parent::buildEntity($form, $form_state);
// Prevent leading and trailing spaces in term names.
$term->setName(trim($term->getName()));
// Assign parents with proper delta values starting from 0.
$term->parent = array_values($form_state->getValue('parent'));
return $term;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.