public function FileTypeForm::validateForm in File Entity (fieldable files) 8.2
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
- src/
Form/ FileTypeForm.php, line 93
Class
- FileTypeForm
- Form controller for file type forms.
Namespace
Drupal\file_entity\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
parent::validateForm($form, $form_state);
$id = trim($form_state
->getValue('id'));
// '0' is invalid, since elsewhere we check it using empty().
if ($id == '0') {
$form_state
->setError($form['id'], $this
->t("Invalid machine-readable name. Enter a name other than %invalid.", array(
'%invalid' => $id,
)));
}
}