You are here

public function SimpleFbConnectSettingsForm::validateForm in Simple FB Connect 8.3

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/SimpleFbConnectSettingsForm.php, line 175

Class

SimpleFbConnectSettingsForm
Defines a form that configures Simple FB Connect settings.

Namespace

Drupal\simple_fb_connect\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (!preg_match('/^v[2-9]\\.[0-9]{1,2}$/', $form_state
    ->getValue('api_version'))) {
    $form_state
      ->setErrorByName('api_version', $this
      ->t('Invalid API version. The syntax for API version is for example <em>v2.8</em>'));
  }
}