public function Currency::__construct in Currency 8.3
Same name in this branch
- 8.3 src/Entity/Currency.php \Drupal\currency\Entity\Currency::__construct()
- 8.3 src/Plugin/views/filter/Currency.php \Drupal\currency\Plugin\views\filter\Currency::__construct()
- 8.3 src/Plugin/views/field/Currency.php \Drupal\currency\Plugin\views\field\Currency::__construct()
Constructs a new instance.
Parameters
mixed[] $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\StringTranslation\TranslationInterface $string_translation: The string translator.
\Drupal\Core\Entity\EntityStorageInterface $currency_storage: THe currency storage.
Throws
\InvalidArgumentException
Overrides HandlerBase::__construct
File
- src/
Plugin/ views/ field/ Currency.php, line 49
Class
- Currency
- A Views field handler to get properties from currencies.
Namespace
Drupal\currency\Plugin\views\fieldCode
public function __construct(array $configuration, $plugin_id, array $plugin_definition, TranslationInterface $string_translation, EntityStorageInterface $currency_storage) {
if (!isset($configuration['currency_method'])) {
throw new \InvalidArgumentException('Missing currency_method definition.');
}
elseif (!method_exists(CurrencyInterface::class, $configuration['currency_method'])) {
throw new \InvalidArgumentException(sprintf('Method %s does not exist on \\Drupal\\currency\\Entity\\CurrencyInterface.', $configuration['currency_method']));
}
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->currencyStorage = $currency_storage;
$this->stringTranslation = $string_translation;
}