scheduled_publish-8.x-3.9/src/Event/ScheduledStateChangeEvent.php

src/Event/ScheduledStateChangeEvent.php
<?php

namespace Drupal\scheduled_publish\Event;

use Drupal\Component\EventDispatcher\Event;
use Drupal\Core\Entity\ContentEntityBase;

/**
 * Event that occurs when an entity changes moderation state on schedule.
 *
 * @see \Drupal\scheduled_publish\ScheduledPublishEvents::SCHEDULED_STATE_CHANGE
 */
class ScheduledStateChangeEvent extends Event {

  /**
   * Constructs a ScheduledStateChangeEvent object.
   *
   * @param \Drupal\Core\Entity\ContentEntityBase $entity
   *   The entity that is changing state.
   * @param string $oldModerationState
   *   The "old" moderation state that the entity is changing from.
   * @param string $newModerationState
   *   The "new" moderation state that the entity will change to.
   * @param string $scheduledPublishField
   *   The scheduled_publish field for the entity changing state.
   * @param mixed $scheduledValue
   *   The new value for the scheduled_publish field.
   */
  public function __construct(
    protected ContentEntityBase $entity,
    protected string $oldModerationState,
    protected string $newModerationState,
    protected string $scheduledPublishField,
    protected mixed $scheduledValue,
  ) {}

  /**
   * Get the entity that is changing state.
   *
   * @return \Drupal\Core\Entity\ContentEntityBase
   *   The entity that is changing state.
   */
  public function getEntity(): ContentEntityBase {
    return $this->entity;
  }

  /**
   * Get the "new" moderation state that the entity will change to.
   *
   * @return string
   *   The "new" moderation state that the entity will change to.
   */
  public function getNewModerationState(): string {
    return $this->newModerationState;
  }

  /**
   * Get the "old" moderation state that the entity is changing from.
   *
   * @return string
   *   The "old" moderation state that the entity is changing from.
   */
  public function getOldModerationState(): string {
    return $this->oldModerationState;
  }

  /**
   * Get the scheduled_publish field for the entity changing state.
   *
   * @return string
   *   The scheduled_publish field for the entity changing state.
   */
  public function getScheduledPublishField(): string {
    return $this->scheduledPublishField;
  }

  /**
   * Get the new value for the scheduled_publish field.
   *
   * @return mixed
   *   The new value for the scheduled_publish field.
   */
  public function getScheduledValue(): mixed {
    return $this->scheduledValue;
  }

}

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

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