You are here

public function EdgeEntityEventDeriverBase::getContext in Apigee Edge 8

Returns an array of event context.

Parameters

\Drupal\apigee_edge\Entity\EdgeEntityTypeInterface $entity_type: The Apigee Edge entity type.

Return value

array An array of event context.

Overrides EdgeEntityEventDeriverInterface::getContext

5 calls to EdgeEntityEventDeriverBase::getContext()
EdgeEntityAddMemberEventDeriver::getContext in modules/apigee_edge_actions/src/Plugin/RulesEvent/EdgeEntityAddMemberEventDeriver.php
Returns an array of event context.
EdgeEntityEventDeriverBase::getDerivativeDefinitions in modules/apigee_edge_actions/src/Plugin/RulesEvent/EdgeEntityEventDeriverBase.php
Gets the definition of all derivatives of a base plugin.
EdgeEntityProductEventDeriverBase::getContext in modules/apigee_edge_actions/src/Plugin/RulesEvent/EdgeEntityProductEventDeriverBase.php
Returns an array of event context.
EdgeEntityRemoveMemberEventDeriver::getContext in modules/apigee_edge_actions/src/Plugin/RulesEvent/EdgeEntityRemoveMemberEventDeriver.php
Returns an array of event context.
EdgeEntityUpdateEventDeriver::getContext in modules/apigee_edge_actions/src/Plugin/RulesEvent/EdgeEntityUpdateEventDeriver.php
Returns an array of event context.
4 methods override EdgeEntityEventDeriverBase::getContext()
EdgeEntityAddMemberEventDeriver::getContext in modules/apigee_edge_actions/src/Plugin/RulesEvent/EdgeEntityAddMemberEventDeriver.php
Returns an array of event context.
EdgeEntityProductEventDeriverBase::getContext in modules/apigee_edge_actions/src/Plugin/RulesEvent/EdgeEntityProductEventDeriverBase.php
Returns an array of event context.
EdgeEntityRemoveMemberEventDeriver::getContext in modules/apigee_edge_actions/src/Plugin/RulesEvent/EdgeEntityRemoveMemberEventDeriver.php
Returns an array of event context.
EdgeEntityUpdateEventDeriver::getContext in modules/apigee_edge_actions/src/Plugin/RulesEvent/EdgeEntityUpdateEventDeriver.php
Returns an array of event context.

File

modules/apigee_edge_actions/src/Plugin/RulesEvent/EdgeEntityEventDeriverBase.php, line 74

Class

EdgeEntityEventDeriverBase
Rules event deriver for Apigee Edge entity types.

Namespace

Drupal\apigee_edge_actions\Plugin\RulesEvent

Code

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;
}