function RestExampleClientEdit::validateForm

Same name in other branches
  1. 4.0.x modules/rest_example/src/Form/RestExampleClientEdit.php \Drupal\rest_example\Form\RestExampleClientEdit::validateForm()

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\Form

Code

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'));
    }
}