You are here

public function AccountSettingsForm::validateForm in Optimizely 8

Same name and namespace in other branches
  1. 8.0 src/AccountSettingsForm.php \Drupal\optimizely\AccountSettingsForm::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

src/AccountSettingsForm.php, line 51

Class

AccountSettingsForm
Implements the form for Account Info.

Namespace

Drupal\optimizely

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  $oid = $form_state
    ->getValue('optimizely_id');
  if (!preg_match('/^\\d+$/', $oid)) {
    $form_state
      ->setErrorByName('optimizely_id', $this
      ->t('Your Optimizely ID should be numeric.'));
  }
}