You are here

class WorkbenchModerationTransitionEvent in Workbench Moderation 8

Same name and namespace in other branches
  1. 8.2 src/Event/WorkbenchModerationTransitionEvent.php \Drupal\workbench_moderation\Event\WorkbenchModerationTransitionEvent

Defines a class for transition events.

Hierarchy

Expanded class hierarchy of WorkbenchModerationTransitionEvent

See also

\Drupal\workbench_moderation\ModerationStateEvents

1 file declares its use of WorkbenchModerationTransitionEvent
EntityOperations.php in src/EntityOperations.php

File

src/Event/WorkbenchModerationTransitionEvent.php, line 13

Namespace

Drupal\workbench_moderation\Event
View source
class WorkbenchModerationTransitionEvent extends Event {

  /**
   * The entity which was changed.
   *
   * @var \Drupal\Core\Entity\ContentEntityInterface
   */
  protected $entity;

  /**
   * The state before the transition.
   *
   * @var string
   */
  protected $stateBefore;

  /**
   * The state after the transition.
   *
   * @var string
   */
  protected $stateAfter;

  /**
   * Creates a new WorkbenchModerationTransitionEvent instance.
   *
   * @param \Drupal\Core\Entity\ContentEntityInterface $entity
   *   The entity which was changed.
   * @param string $state_before
   *   The state before the transition.
   * @param string $state_after
   *   The state after the transition.
   */
  public function __construct(ContentEntityInterface $entity, $state_before, $state_after) {
    $this->entity = $entity;
    $this->stateBefore = $state_before;
    $this->stateAfter = $state_after;
  }

  /**
   * Returns the changed entity.
   *
   * @return \Drupal\Core\Entity\ContentEntityInterface
   *   returns entity.
   */
  public function getEntity() {
    return $this->entity;
  }

  /**
   * Returns state before the transition.
   *
   * @return string
   *   Return state before.
   */
  public function getStateBefore() {
    return $this->stateBefore;
  }

  /**
   * Returns state after the transition.
   *
   * @return string
   *   Return state after.
   */
  public function getStateAfter() {
    return $this->stateAfter;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
WorkbenchModerationTransitionEvent::$entity protected property The entity which was changed.
WorkbenchModerationTransitionEvent::$stateAfter protected property The state after the transition.
WorkbenchModerationTransitionEvent::$stateBefore protected property The state before the transition.
WorkbenchModerationTransitionEvent::getEntity public function Returns the changed entity.
WorkbenchModerationTransitionEvent::getStateAfter public function Returns state after the transition.
WorkbenchModerationTransitionEvent::getStateBefore public function Returns state before the transition.
WorkbenchModerationTransitionEvent::__construct public function Creates a new WorkbenchModerationTransitionEvent instance.