3 namespace Drupal\workflows;
6 * A transition value object that describes the transition between states.
8 class Transition implements TransitionInterface {
11 * The workflow that this transition is attached to.
13 * @var \Drupal\workflows\WorkflowInterface
18 * The transition's ID.
25 * The transition's label.
32 * The transition's from state IDs.
36 protected $fromStateIds;
39 * The transition's to state ID.
46 * The transition's weight.
53 * Transition constructor.
55 * @param \Drupal\workflows\WorkflowInterface $workflow
56 * The workflow the state is attached to.
58 * The transition's ID.
59 * @param string $label
60 * The transition's label.
61 * @param array $from_state_ids
62 * A list of from state IDs.
63 * @param string $to_state_id
66 * (optional) The transition's weight. Defaults to 0.
68 public function __construct(WorkflowTypeInterface $workflow, $id, $label, array $from_state_ids, $to_state_id, $weight = 0) {
69 $this->workflow = $workflow;
71 $this->label = $label;
72 $this->fromStateIds = $from_state_ids;
73 $this->toStateId = $to_state_id;
74 $this->weight = $weight;
80 public function id() {
87 public function label() {
94 public function from() {
95 return $this->workflow->getStates($this->fromStateIds);
101 public function to() {
102 return $this->workflow->getState($this->toStateId);
108 public function weight() {
109 return $this->weight;