headless_cms-1.0.3/modules/headless_cms_notify/src/NotifyMessage/HeadlessNotifyEntityOperationMessage.php

modules/headless_cms_notify/src/NotifyMessage/HeadlessNotifyEntityOperationMessage.php
<?php

declare(strict_types=1);

namespace Drupal\headless_cms_notify\NotifyMessage;

use Drupal\Core\Entity\EntityInterface;
use Drupal\headless_cms_notify\HeadlessNotificationEntityOperation;

/**
 * Headless notification message for entity operations.
 */
class HeadlessNotifyEntityOperationMessage extends HeadlessNotifyMessage {

  public function __construct(
    public readonly EntityInterface $entity,
    public readonly HeadlessNotificationEntityOperation $operation,
  ) {
    parent::__construct(
      "entity_operation",
      $entity->getEntityTypeId(),
      [
        'id' => $entity->id(),
        'uuid' => $entity->uuid(),
        'bundle' => $entity->bundle(),
        'operation' => $operation->value,
      ]
    );
  }

  /**
   * {@inheritdoc}
   */
  public static function getMessageTypeId(): string {
    return "entity_operation";
  }

  /**
   * {@inheritdoc}
   */
  public static function getMessageTypeLabel(): string {
    return "Entity Operation";
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc