You are here

public function FblikebuttonFormSettings::validateForm in Facebook Like Button 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/FblikebuttonFormSettings.php, line 164

Class

FblikebuttonFormSettings

Namespace

Drupal\fblikebutton\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if (null != $form_state
    ->getValue('fblikebutton_weight')) {
    if (!is_numeric($form_state
      ->getValue('fblikebutton_weight'))) {
      $form_state
        ->setErrorByName('fblikebutton_bl_weight', $this
        ->t('The weight of the like button must be a number (examples: 50 or -42 or 0).'));
    }
  }
}