Commit 5a62a6b1 authored by Florent Torregrosa's avatar Florent Torregrosa
Browse files

Issue #3275673 by jurgenhaas, Grimreaper: Move ECA integration into a stand-alone module

parent deab032a
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
name: 'ECA Entity Share'
type: module
description: 'Entity share events, conditions and actions.'
core_version_requirement: ^9
package: 'ECA'
dependencies:
  - 'eca:eca (>= 1.0.0-beta8)'
  - entity_share:entity_share_client
+0 −8
Original line number Diff line number Diff line
services:
  entity_share_client.eca.subscriber:
    class: Drupal\entity_share_eca\EventSubscriber\EcaEntityShare
    arguments:
      - '@eca.processor'
      - '@eca.service.token'
    tags:
      - { name: event_subscriber }
+0 −26
Original line number Diff line number Diff line
<?php

declare(strict_types = 1);

namespace Drupal\entity_share_eca\EventSubscriber;

use Drupal\eca\EventSubscriber\EcaBase;
use Drupal\entity_share_eca\Plugin\ECA\Event\EntityShareClientEvent;

/**
 * ECA event subscriber.
 */
class EcaEntityShare extends EcaBase {

  /**
   * {@inheritdoc}
   */
  public static function getSubscribedEvents(): array {
    $events = [];
    foreach (EntityShareClientEvent::definitions() as $definition) {
      $events[$definition['event_name']][] = ['onEvent'];
    }
    return $events;
  }

}
+0 −33
Original line number Diff line number Diff line
<?php

declare(strict_types = 1);

namespace Drupal\entity_share_eca\Plugin\ECA\Event;

use Drupal\eca\Plugin\ECA\Event\EventBase;
use Drupal\entity_share_client\Event\RelationshipFieldValueEvent;

/**
 * Plugin implementation of the ECA Events for content entities.
 *
 * @EcaEvent(
 *   id = "entity_share_eca",
 *   label = @Translation("Entity share: Relationship Field Value")
 * )
 */
class EntityShareClientEvent extends EventBase {

  /**
   * {@inheritdoc}
   */
  public static function definitions(): array {
    return [
      'entity_share_eca_rel_field_value' => [
        'label' => 'Entity share: Relationship Field Value',
        'event_name' => RelationshipFieldValueEvent::EVENT_NAME,
        'event_class' => RelationshipFieldValueEvent::class,
      ],
    ];
  }

}