You are here

class GetLocationEvent in Smart IP 8.4

Same name and namespace in other branches
  1. 8.2 src/GetLocationEvent.php \Drupal\smart_ip\GetLocationEvent
  2. 8.3 src/GetLocationEvent.php \Drupal\smart_ip\GetLocationEvent

Provides Smart IP query location override event for event listeners.

@package Drupal\smart_ip

Hierarchy

  • class \Drupal\smart_ip\GetLocationEvent extends \Symfony\Component\EventDispatcher\Event

Expanded class hierarchy of GetLocationEvent

6 files declare their use of GetLocationEvent
SmartIpEventSubscriber.php in modules/device_geolocation/src/EventSubscriber/SmartIpEventSubscriber.php
Contains \Drupal\device_geolocation\EventSubscriber\SmartIpEventSubscriber.
SmartIpEventSubscriber.php in modules/smart_ip_maxmind_geoip2_bin_db/src/EventSubscriber/SmartIpEventSubscriber.php
Contains \Drupal\smart_ip_maxmind_geoip2_bin_db\EventSubscriber\SmartIpEventSubscriber.
SmartIpEventSubscriber.php in modules/smart_ip_ipinfodb_web_service/src/EventSubscriber/SmartIpEventSubscriber.php
Contains \Drupal\smart_ip_ipinfodb_web_service\EventSubscriber\SmartIpEventSubscriber.
SmartIpEventSubscriber.php in modules/smart_ip_ip2location_bin_db/src/EventSubscriber/SmartIpEventSubscriber.php
Contains \Drupal\smart_ip_ip2location_bin_db\EventSubscriber\SmartIpEventSubscriber.
SmartIpEventSubscriber.php in modules/smart_ip_abstract_web_service/src/EventSubscriber/SmartIpEventSubscriber.php
Contains \Drupal\smart_ip_abstract_web_service\EventSubscriber\SmartIpEventSubscriber.

... See full list

1 string reference to 'GetLocationEvent'
smart_ip.services.yml in ./smart_ip.services.yml
smart_ip.services.yml
1 service uses GetLocationEvent
smart_ip.get_location_event in ./smart_ip.services.yml
Drupal\smart_ip\GetLocationEvent

File

src/GetLocationEvent.php, line 16
Contains \Drupal\smart_ip\GetLocationEvent.

Namespace

Drupal\smart_ip
View source
class GetLocationEvent extends Event {

  /**
   * Contains user's location.
   *
   * @var \Drupal\smart_ip\SmartIpLocationInterface
   */
  protected $location;

  /**
   * Contains Smart IP data source info.
   *
   * @var string
   */
  protected $dataSource;

  /**
   * Constructs a Smart IP event.
   *
   * @param \Drupal\smart_ip\SmartIpLocationInterface $location
   *   Smart IP's data location.
   */
  public function __construct(SmartIpLocationInterface $location) {
    $this
      ->setLocation($location);
    $this->dataSource = \Drupal::config('smart_ip.settings')
      ->get('data_source');
  }

  /**
   * Get Smart IP's data location.
   *
   * @return \Drupal\smart_ip\SmartIpLocationInterface
   *   Smart IP's data location.
   */
  public function getLocation() {
    return $this->location;
  }

  /**
   * Set Smart IP's data location.
   *
   * @param \Drupal\smart_ip\SmartIpLocationInterface $location
   *   Smart IP's data location.
   */
  public function setLocation(SmartIpLocationInterface $location) {
    $this->location = $location;
  }

  /**
   * Get Smart IP's data source.
   *
   * @return string
   *   Smart IP's data source.
   */
  public function getDataSource() {
    return $this->dataSource;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
GetLocationEvent::$dataSource protected property Contains Smart IP data source info.
GetLocationEvent::$location protected property Contains user's location.
GetLocationEvent::getDataSource public function Get Smart IP's data source.
GetLocationEvent::getLocation public function Get Smart IP's data location.
GetLocationEvent::setLocation public function Set Smart IP's data location.
GetLocationEvent::__construct public function Constructs a Smart IP event.