GeoLocatorBase.php in GeoIP API 8.2
File
src/Plugin/GeoLocator/GeoLocatorBase.php
View source
<?php
namespace Drupal\geoip\Plugin\GeoLocator;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Plugin\PluginBase;
use Psr\Log\LoggerInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
abstract class GeoLocatorBase extends PluginBase implements GeoLocatorInterface, ContainerFactoryPluginInterface {
protected $geoIpConfig;
protected $logger;
public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory, LoggerInterface $logger) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->geoIpConfig = $config_factory
->get('geoip.geolocation');
$this->logger = $logger;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('config.factory'), $container
->get('logger.factory')
->get('geoip'));
}
public function getId() {
return $this
->getPluginId();
}
public function getLabel() {
return $this->pluginDefinition['label'];
}
public function getDescription() {
return $this->pluginDefinition['description'];
}
}