You are here

public function AppCallbackUrlSettingsForm::validateForm in Apigee Edge 8

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/AppCallbackUrlSettingsForm.php, line 93

Class

AppCallbackUrlSettingsForm
Provides configuration form for app callback settings.

Namespace

Drupal\apigee_edge\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  parent::validateForm($form, $form_state);
  if (mb_strpos($form_state
    ->getValue([
    'callback_url',
    'pattern',
  ], ''), '^http') === FALSE) {
    $form_state
      ->setError($form['callback_url']['pattern'], $this
      ->t('The pattern should start with <em>^http</em> to limit the acceptable protocols.'));
  }
}