public function NodeTypeForm::validateForm in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/node/src/NodeTypeForm.php \Drupal\node\NodeTypeForm::validateForm()
Form validation handler.
Parameters
array $form: An associative array containing the structure of the form.
\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.
Overrides FormBase::validateForm
File
- core/
modules/ node/ src/ NodeTypeForm.php, line 207 - Contains \Drupal\node\NodeTypeForm.
Class
- NodeTypeForm
- Form controller 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.", array(
'%invalid' => $id,
)));
}
}