You are here

SmartIpEventSubscriberBase.php in Smart IP 8.2

Namespace

Drupal\smart_ip

File

src/SmartIpEventSubscriberBase.php
View source
<?php

/**
 * @file
 * Contains \Drupal\smart_ip\SmartIpEventSubscriberBase.
 */
namespace Drupal\smart_ip;

use Symfony\Component\EventDispatcher\EventSubscriberInterface;

/**
 * Provides a base class for Smart IP data source modules.
 */
abstract class SmartIpEventSubscriberBase implements EventSubscriberInterface, SmartIpDataSourceInterface {

  /**
   * {@inheritdoc}
   */
  public function includeEditableConfigNames(AdminSettingsEvent $event) {
    $configNames = $event
      ->getEditableConfigNames();
    $configNames[] = $this
      ->configName();
    $event
      ->setEditableConfigNames($configNames);
  }

  /**
   * {@inheritdoc}
   */
  static function getSubscribedEvents() {
    $events[SmartIpEvents::QUERY_IP][] = array(
      'processQuery',
    );
    $events[SmartIpEvents::DISPLAY_SETTINGS][] = array(
      'formSettings',
    );
    $events[SmartIpEvents::VALIDATE_SETTINGS][] = array(
      'validateFormSettings',
    );
    $events[SmartIpEvents::SUBMIT_SETTINGS][] = array(
      'submitFormSettings',
    );
    $events[SmartIpEvents::GET_CONFIG_NAME][] = array(
      'includeEditableConfigNames',
    );
    $events[SmartIpEvents::MANUAL_UPDATE][] = array(
      'manualUpdate',
    );
    $events[SmartIpEvents::CRON_RUN][] = array(
      'cronRun',
    );
    return $events;
  }

}

Classes

Namesort descending Description
SmartIpEventSubscriberBase Provides a base class for Smart IP data source modules.