You are here

public function SmartIpEventSubscriber::submitFormSettings 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::submitFormSettings()
  2. 8.3 modules/smart_ip_ipinfodb_web_service/src/EventSubscriber/SmartIpEventSubscriber.php \Drupal\smart_ip_ipinfodb_web_service\EventSubscriber\SmartIpEventSubscriber::submitFormSettings()

Act on submission of main Smart IP admin settings form.

Parameters

\Drupal\smart_ip\AdminSettingsEvent $event:

Overrides SmartIpDataSourceInterface::submitFormSettings

File

modules/smart_ip_ipinfodb_web_service/src/EventSubscriber/SmartIpEventSubscriber.php, line 158
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 submitFormSettings(AdminSettingsEvent $event) {
  $config = \Drupal::configFactory()
    ->getEditable(self::configName());

  /** @var \Drupal\Core\Form\FormStateInterface $formState */
  $formState = $event
    ->getFormState();
  $config
    ->set('version', $formState
    ->getValue('ipinfodb_api_version'))
    ->set('api_key', $formState
    ->getValue('ipinfodb_api_key'))
    ->save();
}