public function ExchangerProviderBase::__construct in Commerce Exchanger 8
Constructs a new ExchangeProvider object.
Parameters
array $configuration: A configuration array containing information about the plugin instance.
string $plugin_id: The plugin_id for the plugin instance.
mixed $plugin_definition: The plugin implementation definition.
\Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager: Currency storage.
\Drupal\Core\Http\ClientFactory $http_client_factory: Drupal http client.
\Drupal\Core\Config\ConfigFactory $config_factory: Config factory.
\Psr\Log\LoggerInterface $logger_channel: Logger.
Overrides PluginBase::__construct
File
- src/
Plugin/ Commerce/ ExchangerProvider/ ExchangerProviderBase.php, line 81
Class
- ExchangerProviderBase
- Base class for Commerce exchanger provider plugins.
Namespace
Drupal\commerce_exchanger\Plugin\Commerce\ExchangerProviderCode
public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager, ClientFactory $http_client_factory, ConfigFactory $config_factory, LoggerInterface $logger_channel) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->currencyStorage = $entity_type_manager
->getStorage('commerce_currency');
$this->httpClientFactory = $http_client_factory;
$this->configFactory = $config_factory;
$this->logger = $logger_channel;
if (array_key_exists('_entity_id', $configuration)) {
$this->entityId = $configuration['_entity_id'];
unset($configuration['_entity_id']);
}
$this
->setConfiguration($configuration);
$this->currencies = $this
->getCurrencies();
}