3 namespace Drupal\workflows;
6 * An interface for state value objects.
9 * The StateInterface should only be used by Workflows and Content Moderation.
10 * @todo Revisit the need for this in https://www.drupal.org/node/2902309.
12 interface StateInterface {
15 * The key of the state plugin form.
17 const PLUGIN_FORM_KEY = 'state';
20 * Gets the state's ID.
28 * Gets the state's label.
33 public function label();
36 * Gets the state's weight.
41 public function weight();
44 * Determines if the state can transition to the provided state ID.
47 * The state to transition to.
50 * TRUE if the state can transition to the provided state ID. FALSE, if not.
52 public function canTransitionTo($to_state_id);
55 * Gets the Transition object for the provided state ID.
58 * The state to transition to.
60 * @return \Drupal\workflows\TransitionInterface
61 * The Transition object for the provided state ID.
63 * @throws \InvalidArgumentException()
64 * Exception thrown when the provided state ID can not be transitioned to.
66 public function getTransitionTo($to_state_id);
69 * Gets all the possible transition objects for the state.
71 * @return \Drupal\workflows\TransitionInterface[]
72 * All the possible transition objects for the state.
74 public function getTransitions();