function NodeTypeForm::buildEntity
Same name in this branch
- 11.x core/modules/node/src/Form/NodeTypeForm.php \Drupal\node\Form\NodeTypeForm::buildEntity()
Same name in other branches
- 10 core/modules/node/src/NodeTypeForm.php \Drupal\node\NodeTypeForm::buildEntity()
Overrides EntityForm::buildEntity
File
-
core/
modules/ node/ src/ NodeTypeForm.php, line 207
Class
- NodeTypeForm
- Form handler for node type forms.
Namespace
Drupal\nodeCode
public function buildEntity(array $form, FormStateInterface $form_state) {
/** @var \Drupal\node\NodeTypeInterface $entity */
$entity = parent::buildEntity($form, $form_state);
// The description and help text cannot be empty strings.
if (trim($form_state->getValue('description')) === '') {
$entity->set('description', NULL);
}
if (trim($form_state->getValue('help')) === '') {
$entity->set('help', NULL);
}
return $entity;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.