You are here

public function CampaignMonitorManager::__construct in Campaign Monitor 8.2

The constructor.

Parameters

\Drupal\Core\Config\ConfigFactoryInterface $config_factory: The config factory.

\Drupal\Core\Logger\LoggerChannelFactoryInterface $logger_factory: The loggers service.

\Drupal\Core\Cache\CacheBackendInterface $cache_backend: The cache service.

\Drupal\Core\Language\LanguageManagerInterface $language_manager: The language manager service.

\Drupal\Core\Extension\ModuleHandlerInterface $module_handler: The module handler.

2 methods override CampaignMonitorManager::__construct()
CampaignMonitorSubscriptionManager::__construct in src/CampaignMonitorSubscriptionManager.php
The constructor.
CampaignMonitorUserManager::__construct in modules/campaignmonitor_user/src/CampaignMonitorUserManager.php
The constructor.

File

src/CampaignMonitorManager.php, line 147

Class

CampaignMonitorManager
Manager for Campaignmonitor.

Namespace

Drupal\campaignmonitor

Code

public function __construct(ConfigFactoryInterface $config_factory, LoggerChannelFactoryInterface $logger_factory, CacheBackendInterface $cache_backend, LanguageManagerInterface $language_manager, ModuleHandlerInterface $module_handler) {
  $this->loggerFactory = $logger_factory;
  $this->cacheBackend = $cache_backend;
  $this->languageManager = $language_manager;
  $this->moduleHandler = $module_handler;
  $this->configFactory = $config_factory;

  // Get account information.
  $this->config = $config_factory
    ->get('campaignmonitor.settings');

  // Get API key/client ID if they are defined.
  $this->apiKey = $this->config
    ->get('api_key');
  $this->clientId = $this->config
    ->get('client_id');

  // Enable logging.
  if ($this->config
    ->get('logging')) {
    $this->logErrors = $this->config
      ->get('logging');
  }
}