You are here

public function BetterSocialSharingButtonsForm::validateForm in Better Social Sharing Buttons 8

Same name and namespace in other branches
  1. 8.3 src/Form/BetterSocialSharingButtonsForm.php \Drupal\better_social_sharing_buttons\Form\BetterSocialSharingButtonsForm::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/Form/BetterSocialSharingButtonsForm.php, line 170

Class

BetterSocialSharingButtonsForm
Class SettingsForm.

Namespace

Drupal\better_social_sharing_buttons\Form

Code

public function validateForm(array &$form, FormStateInterface $form_state) {
  if ($form_state
    ->getValue('services')['facebook_messenger']) {
    $appid = $form_state
      ->getValue('facebook_app_id');
    if (!is_numeric($appid)) {
      $form_state
        ->setErrorByName('facebook_app_id', $this
        ->t('Facebook App Id should be numeric'));
    }
  }
}