You are here

class WorkflowTransition in State Machine 8

Defines the class for workflow transitions.

Hierarchy

Expanded class hierarchy of WorkflowTransition

6 files declare their use of WorkflowTransition
FulfillmentGuard.php in tests/modules/state_machine_test/src/Guard/FulfillmentGuard.php
GenericGuard.php in tests/modules/state_machine_test/src/Guard/GenericGuard.php
GuardInterface.php in src/Guard/GuardInterface.php
StateItem.php in src/Plugin/Field/FieldType/StateItem.php
StateItemInterface.php in src/Plugin/Field/FieldType/StateItemInterface.php

... See full list

File

src/Plugin/Workflow/WorkflowTransition.php, line 8

Namespace

Drupal\state_machine\Plugin\Workflow
View source
class WorkflowTransition {

  /**
   * The transition ID.
   *
   * @var string
   */
  protected $id;

  /**
   * The transition label.
   *
   * @var string
   */
  protected $label;

  /**
   * The "from" states.
   *
   * @var \Drupal\state_machine\Plugin\Workflow\WorkflowState[]
   */
  protected $fromStates;

  /**
   * The "to" state.
   *
   * @var \Drupal\state_machine\Plugin\Workflow\WorkflowState
   */
  protected $toState;

  /**
   * Constructs a new WorkflowTransition object.
   *
   * @param string $id
   *   The transition ID.
   * @param string $label
   *   The transition label.
   * @param \Drupal\state_machine\Plugin\Workflow\WorkflowState[] $from_states
   *   The "from" states.
   * @param \Drupal\state_machine\Plugin\Workflow\WorkflowState $to_state
   *   The "to" state.
   */
  public function __construct($id, $label, array $from_states, WorkflowState $to_state) {
    $this->id = $id;
    $this->label = $label;
    $this->fromStates = $from_states;
    $this->toState = $to_state;
  }

  /**
   * Gets the ID.
   *
   * @return string
   *   The ID.
   */
  public function getId() {
    return $this->id;
  }

  /**
   * Gets the translated label.
   *
   * @return string
   *   The translated label.
   */
  public function getLabel() {
    return (string) t($this->label, [], [
      'context' => 'workflow transition',
    ]);
  }

  /**
   * Gets the "from" states.
   *
   * @return \Drupal\state_machine\Plugin\Workflow\WorkflowState[]
   *   The "from" states.
   */
  public function getFromStates() {
    return $this->fromStates;
  }

  /**
   * Gets the "to" state.
   *
   * @return \Drupal\state_machine\Plugin\Workflow\WorkflowState
   *   The "to" state.
   */
  public function getToState() {
    return $this->toState;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
WorkflowTransition::$fromStates protected property The "from" states.
WorkflowTransition::$id protected property The transition ID.
WorkflowTransition::$label protected property The transition label.
WorkflowTransition::$toState protected property The "to" state.
WorkflowTransition::getFromStates public function Gets the "from" states.
WorkflowTransition::getId public function Gets the ID.
WorkflowTransition::getLabel public function Gets the translated label.
WorkflowTransition::getToState public function Gets the "to" state.
WorkflowTransition::__construct public function Constructs a new WorkflowTransition object.