class ConfigDeriver in Payment 8.2
Derives payment status plugin definitions based on configuration entities.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\payment\Plugin\Payment\Status\ConfigDeriver implements ContainerDeriverInterface
Expanded class hierarchy of ConfigDeriver
1 file declares its use of ConfigDeriver
- ConfigDeriverTest.php in tests/
src/ Unit/ Plugin/ Payment/ Status/ ConfigDeriverTest.php
1 string reference to 'ConfigDeriver'
File
- src/
Plugin/ Payment/ Status/ ConfigDeriver.php, line 13
Namespace
Drupal\payment\Plugin\Payment\StatusView source
class ConfigDeriver extends DeriverBase implements ContainerDeriverInterface {
/**
* The payment status storage controller.
*
* @var \Drupal\Core\Entity\EntityStorageInterface
*/
protected $paymentStatusStorage;
/**
* Constructs a new instance.
*/
public function __construct(EntityStorageInterface $payment_status_storage) {
$this->paymentStatusStorage = $payment_status_storage;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container
->get('entity_type.manager')
->getStorage('payment_status'));
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
/** @var \Drupal\payment\Entity\PaymentStatusInterface[] $statuses */
$statuses = $this->paymentStatusStorage
->loadMultiple();
foreach ($statuses as $status) {
$this->derivatives[$status
->id()] = array(
'description' => $status
->getDescription(),
'label' => $status
->label(),
'parent_id' => $status
->getParentId(),
) + $base_plugin_definition;
}
return parent::getDerivativeDefinitions($base_plugin_definition);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigDeriver:: |
protected | property | The payment status storage controller. | |
ConfigDeriver:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
ConfigDeriver:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
ConfigDeriver:: |
public | function | Constructs a new instance. | |
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |