You are here

public function RemoteForm::validateForm in Entity Share 8

Same name and namespace in other branches
  1. 8.3 modules/entity_share_client/src/Form/RemoteForm.php \Drupal\entity_share_client\Form\RemoteForm::validateForm()
  2. 8.2 modules/entity_share_client/src/Form/RemoteForm.php \Drupal\entity_share_client\Form\RemoteForm::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

modules/entity_share_client/src/Form/RemoteForm.php, line 75

Class

RemoteForm
Class RemoteForm.

Namespace

Drupal\entity_share_client\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {

  // Validate URL.
  if (!UrlHelper::isValid($form_state
    ->getValue('url'), TRUE)) {
    $form_state
      ->setError($form['url'], $this
      ->t('Invalid URL.'));
  }
}