Skip to content
Snippets Groups Projects
Commit 3ce5e04e authored by Fabio De Tant's avatar Fabio De Tant Committed by Tim Diels
Browse files

Issue #3276915 by dtfabio, tim-diels: Clean up ActiveCampaignApi service

parent b3c0303a
No related branches found
No related tags found
1 merge request!6Issue #3276915: Clean up ActiveCampaignApi service
services:
activecampaign.api:
class: Drupal\activecampaign\ActiveCampaignApi
arguments: ['@config.storage']
arguments: ['@config.factory']
......@@ -3,7 +3,7 @@
namespace Drupal\activecampaign;
use Drupal\Component\Utility\UrlHelper;
use Drupal\Core\Config\StorageInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Url;
/**
......@@ -18,6 +18,13 @@ class ActiveCampaignApi {
*/
protected $activeCampaignSDK;
/**
* The config factory.
*
* @var \Drupal\Core\Config\ConfigFactoryInterface
*/
protected $configFactory;
/**
* The url to active campaign.
*
......@@ -28,11 +35,12 @@ class ActiveCampaignApi {
/**
* Constructs an Api object.
*
* @param \Drupal\Core\Config\StorageInterface $storage
* The active configuration storage.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* The configuration factory.
*/
public function __construct(StorageInterface $storage) {
$config = \Drupal::config('activecampaign.settings');
public function __construct(ConfigFactoryInterface $config_factory) {
$this->configFactory = $config_factory;
$config = $this->configFactory->get('activecampaign.settings');
$this->url = $config->get('url');
$this->activeCampaignSDK = new \ActiveCampaign($config->get('api_url'), $config->get('api_key'));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment