abstract class EdgeEntityEventDeriverBase in Apigee Edge 8
Rules event deriver for Apigee Edge entity types.
Hierarchy
- class \Drupal\Component\Plugin\Derivative\DeriverBase implements DeriverInterface
- class \Drupal\apigee_edge_actions\Plugin\RulesEvent\EdgeEntityEventDeriverBase implements EdgeEntityEventDeriverInterface uses StringTranslationTrait
Expanded class hierarchy of EdgeEntityEventDeriverBase
File
- modules/
apigee_edge_actions/ src/ Plugin/ RulesEvent/ EdgeEntityEventDeriverBase.php, line 34
Namespace
Drupal\apigee_edge_actions\Plugin\RulesEventView source
abstract class EdgeEntityEventDeriverBase extends DeriverBase implements EdgeEntityEventDeriverInterface {
use StringTranslationTrait;
/**
* The apigee app entity type manager service.
*
* @var \Drupal\apigee_edge_actions\ApigeeActionsEntityTypeHelperInterface
*/
protected $edgeEntityTypeManager;
/**
* AppEventDeriver constructor.
*
* @param \Drupal\apigee_edge_actions\ApigeeActionsEntityTypeHelperInterface $edge_entity_type_manager
* The apigee app entity type manager service.
*/
public function __construct(ApigeeActionsEntityTypeHelperInterface $edge_entity_type_manager) {
$this->edgeEntityTypeManager = $edge_entity_type_manager;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container, $base_plugin_id) {
return new static($container
->get('apigee_edge_actions.edge_entity_type_manager'));
}
/**
* {@inheritdoc}
*/
public function getEntityTypes() : array {
return $this->edgeEntityTypeManager
->getEntityTypes();
}
/**
* {@inheritdoc}
*/
public function getContext(EdgeEntityTypeInterface $entity_type) : array {
$context = [
$entity_type
->id() => [
'type' => "entity:{$entity_type->id()}",
'label' => $entity_type
->getLabel(),
],
];
// Add additional context for App.
if ($entity_type
->entityClassImplements(AppInterface::class)) {
// Add the developer to the context.
$context['developer'] = [
'type' => 'entity:user',
'label' => 'Developer',
];
// Add the team to the context.
if ($entity_type
->entityClassImplements(TeamAppInterface::class)) {
$context['team'] = [
'type' => 'entity:team',
'label' => 'Team',
];
}
}
return $context;
}
/**
* {@inheritdoc}
*/
public function getDerivativeDefinitions($base_plugin_definition) {
foreach ($this
->getEntityTypes() as $entity_type) {
$this->derivatives[$entity_type
->id()] = [
'label' => $this
->getLabel($entity_type),
'category' => $entity_type
->getLabel(),
'entity_type_id' => $entity_type
->id(),
'context_definitions' => $this
->getContext($entity_type),
] + $base_plugin_definition;
}
return $this->derivatives;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DeriverBase:: |
protected | property | List of derivative definitions. | 1 |
DeriverBase:: |
public | function |
Gets the definition of a derivative plugin. Overrides DeriverInterface:: |
|
EdgeEntityEventDeriverBase:: |
protected | property | The apigee app entity type manager service. | |
EdgeEntityEventDeriverBase:: |
public static | function |
Creates a new class instance. Overrides ContainerDeriverInterface:: |
|
EdgeEntityEventDeriverBase:: |
public | function |
Returns an array of event context. Overrides EdgeEntityEventDeriverInterface:: |
4 |
EdgeEntityEventDeriverBase:: |
public | function |
Gets the definition of all derivatives of a base plugin. Overrides DeriverBase:: |
|
EdgeEntityEventDeriverBase:: |
public | function |
Returns an array of entity types that are compatible to this event. Overrides EdgeEntityEventDeriverInterface:: |
3 |
EdgeEntityEventDeriverBase:: |
public | function | AppEventDeriver constructor. | |
EdgeEntityEventDeriverInterface:: |
public | function | Returns the event's label. Example: 'After saving a new App'. | 7 |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |