You are here

public function SmartIpEventSubscriber::validateFormSettings in Smart IP 8.2

Same name and namespace in other branches
  1. 8.4 modules/smart_ip_ipinfodb_web_service/src/EventSubscriber/SmartIpEventSubscriber.php \Drupal\smart_ip_ipinfodb_web_service\EventSubscriber\SmartIpEventSubscriber::validateFormSettings()
  2. 8.3 modules/smart_ip_ipinfodb_web_service/src/EventSubscriber/SmartIpEventSubscriber.php \Drupal\smart_ip_ipinfodb_web_service\EventSubscriber\SmartIpEventSubscriber::validateFormSettings()

Act on validation of main Smart IP admin settings form.

Parameters

\Drupal\smart_ip\AdminSettingsEvent $event:

Overrides SmartIpDataSourceInterface::validateFormSettings

File

modules/smart_ip_ipinfodb_web_service/src/EventSubscriber/SmartIpEventSubscriber.php, line 147
Contains \Drupal\smart_ip_ipinfodb_web_service\EventSubscriber\SmartIpEventSubscriber.

Class

SmartIpEventSubscriber
Core functionalty of this Smart IP data source module. Listens to Smart IP override events.

Namespace

Drupal\smart_ip_ipinfodb_web_service\EventSubscriber

Code

public function validateFormSettings(AdminSettingsEvent $event) {

  /** @var \Drupal\Core\Form\FormStateInterface $formState */
  $formState = $event
    ->getFormState();
  if ($formState
    ->isValueEmpty('ipinfodb_api_key')) {
    $formState
      ->setErrorByName('ipinfodb_api_key', t('Please provide IPInfoDB API key.'));
  }
}