You are here

class ContentModerationStateChangedEvent in Workbench Email 2.x

Same name and namespace in other branches
  1. 8 src/EventSubscriber/ContentModerationStateChangedEvent.php \Drupal\workbench_email\EventSubscriber\ContentModerationStateChangedEvent

Defines content moderation state change events.

@todo Remove when https://www.drupal.org/project/drupal/issues/2873287 is in.

Hierarchy

Expanded class hierarchy of ContentModerationStateChangedEvent

1 file declares its use of ContentModerationStateChangedEvent
workbench_email.module in ./workbench_email.module
Provides main module functions.

File

src/EventSubscriber/ContentModerationStateChangedEvent.php, line 13

Namespace

Drupal\workbench_email\EventSubscriber
View source
class ContentModerationStateChangedEvent extends Event {

  /**
   * The entity that was moderated.
   *
   * @var \Drupal\Core\Entity\ContentEntityInterface
   */
  protected $moderatedEntity;

  /**
   * The state the content has changed to.
   *
   * @var string
   */
  protected $newState;

  /**
   * The state the content was before, or FALSE if none existed.
   *
   * @var string|FALSE
   */
  protected $originalState;

  /**
   * The ID of the workflow which allowed the state change.
   *
   * @var string
   */
  protected $workflow;

  /**
   * Create a new ContentModerationStateChangedEvent.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface $moderated_entity
   *   The entity that is being moderated.
   * @param string $new_state
   *   The new state the content is moving to.
   * @param string $original_state
   *   The original state of the content, before the change was made.
   * @param string $workflow
   *   The ID of the workflow that allowed the state change.
   */
  public function __construct(ContentEntityInterface $moderated_entity, $new_state, $original_state, $workflow) {
    $this->moderatedEntity = $moderated_entity;
    $this->newState = $new_state;
    $this->originalState = $original_state;
    $this->workflow = $workflow;
  }

  /**
   * Get the entity that is being moderated.
   *
   * @return \Drupal\Core\Entity\ContentEntityInterface
   *   The entity that is being moderated.
   */
  public function getModeratedEntity() {
    return $this->moderatedEntity;
  }

  /**
   * Get the new state of the content.
   *
   * @return string
   *   The state the content has been changed to.
   */
  public function getNewState() {
    return $this->newState;
  }

  /**
   * Get the original state of the content.
   *
   * @return string
   *   The state the content was before.
   */
  public function getOriginalState() {
    return $this->originalState;
  }

  /**
   * Get the ID of the workflow which allowed this state change.
   *
   * @return string
   *   The ID of the workflow.
   */
  public function getWorkflow() {
    return $this->workflow;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ContentModerationStateChangedEvent::$moderatedEntity protected property The entity that was moderated.
ContentModerationStateChangedEvent::$newState protected property The state the content has changed to.
ContentModerationStateChangedEvent::$originalState protected property The state the content was before, or FALSE if none existed.
ContentModerationStateChangedEvent::$workflow protected property The ID of the workflow which allowed the state change.
ContentModerationStateChangedEvent::getModeratedEntity public function Get the entity that is being moderated.
ContentModerationStateChangedEvent::getNewState public function Get the new state of the content.
ContentModerationStateChangedEvent::getOriginalState public function Get the original state of the content.
ContentModerationStateChangedEvent::getWorkflow public function Get the ID of the workflow which allowed this state change.
ContentModerationStateChangedEvent::__construct public function Create a new ContentModerationStateChangedEvent.