function NodeTypeForm::validateForm
Same name in other branches
- 9 core/modules/node/src/NodeTypeForm.php \Drupal\node\NodeTypeForm::validateForm()
- 10 core/modules/node/src/NodeTypeForm.php \Drupal\node\NodeTypeForm::validateForm()
- 11.x core/modules/node/src/NodeTypeForm.php \Drupal\node\NodeTypeForm::validateForm()
Overrides FormBase::validateForm
File
-
core/
modules/ node/ src/ NodeTypeForm.php, line 212
Class
- NodeTypeForm
- Form handler for node type forms.
Namespace
Drupal\nodeCode
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
$id = trim($form_state->getValue('type'));
// '0' is invalid, since elsewhere we check it using empty().
if ($id == '0') {
$form_state->setErrorByName('type', $this->t("Invalid machine-readable name. Enter a name other than %invalid.", [
'%invalid' => $id,
]));
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.