function VocabularyForm::buildEntity
Same name in other branches
- 11.x core/modules/taxonomy/src/VocabularyForm.php \Drupal\taxonomy\VocabularyForm::buildEntity()
Overrides EntityForm::buildEntity
File
-
core/
modules/ taxonomy/ src/ VocabularyForm.php, line 48
Class
- VocabularyForm
- Base form for vocabulary edit forms.
Namespace
Drupal\taxonomyCode
public function buildEntity(array $form, FormStateInterface $form_state) {
/** @var \Drupal\taxonomy\VocabularyInterface $entity */
$entity = parent::buildEntity($form, $form_state);
// The description cannot be an empty string.
if (trim($form_state->getValue('description')) === '') {
$entity->set('description', NULL);
}
return $entity;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.