3 namespace Drupal\workflows;
6 * A transition value object that describes the transition between states.
9 * The workflow system is currently experimental and should only be leveraged
10 * by experimental modules and development releases of contributed modules.
12 class Transition implements TransitionInterface {
15 * The workflow that this transition is attached to.
17 * @var \Drupal\workflows\WorkflowInterface
22 * The transition's ID.
29 * The transition's label.
36 * The transition's from state IDs.
40 protected $fromStateIds;
43 * The transition's to state ID.
50 * The transition's weight.
57 * Transition constructor.
59 * @param \Drupal\workflows\WorkflowInterface $workflow
60 * The workflow the state is attached to.
62 * The transition's ID.
63 * @param string $label
64 * The transition's label.
65 * @param array $from_state_ids
66 * A list of from state IDs.
67 * @param string $to_state_id
70 * (optional) The transition's weight. Defaults to 0.
72 public function __construct(WorkflowInterface $workflow, $id, $label, array $from_state_ids, $to_state_id, $weight = 0) {
73 $this->workflow = $workflow;
75 $this->label = $label;
76 $this->fromStateIds = $from_state_ids;
77 $this->toStateId = $to_state_id;
78 $this->weight = $weight;
84 public function id() {
91 public function label() {
98 public function from() {
99 return $this->workflow->getStates($this->fromStateIds);
105 public function to() {
106 return $this->workflow->getState($this->toStateId);
112 public function weight() {
113 return $this->weight;