public function RestExampleClientEdit::validateForm in Examples for Developers 3.x
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
- modules/
rest_example/ src/ Form/ RestExampleClientEdit.php, line 52
Class
- RestExampleClientEdit
- Edit or create a new node on a remote Drupal site.
Namespace
Drupal\rest_example\FormCode
public function validateForm(array &$form, FormStateInterface $form_state) {
if (!is_null($form_state
->get('node_id')) && !is_numeric($form_state
->get('node_id'))) {
$form_state
->setErrorByName('submit', $this
->t('The ID passed in the URL is not an integer'));
}
}