interface StateInterface
Same name in this branch
- 11.x core/lib/Drupal/Core/State/StateInterface.php \Drupal\Core\State\StateInterface
Same name in other branches
- 9 core/modules/workflows/src/StateInterface.php \Drupal\workflows\StateInterface
- 9 core/lib/Drupal/Core/State/StateInterface.php \Drupal\Core\State\StateInterface
- 8.9.x core/modules/workflows/src/StateInterface.php \Drupal\workflows\StateInterface
- 8.9.x core/lib/Drupal/Core/State/StateInterface.php \Drupal\Core\State\StateInterface
- 10 core/modules/workflows/src/StateInterface.php \Drupal\workflows\StateInterface
- 10 core/lib/Drupal/Core/State/StateInterface.php \Drupal\Core\State\StateInterface
An interface for state value objects.
@internal The StateInterface should only be used by Workflows and Content Moderation. @todo Revisit the need for this in https://www.drupal.org/node/2902309.
Hierarchy
- interface \Drupal\workflows\StateInterface
Expanded class hierarchy of StateInterface
All classes that implement StateInterface
8 files declare their use of StateInterface
- ContentModeration.php in core/
modules/ content_moderation/ src/ Plugin/ WorkflowType/ ContentModeration.php - ContentModerationState.php in core/
modules/ content_moderation/ src/ ContentModerationState.php - ContentModerationStateForm.php in core/
modules/ content_moderation/ src/ Form/ ContentModerationStateForm.php - StateTransitionValidation.php in core/
modules/ content_moderation/ src/ StateTransitionValidation.php - StateTransitionValidationInterface.php in core/
modules/ content_moderation/ src/ StateTransitionValidationInterface.php
File
-
core/
modules/ workflows/ src/ StateInterface.php, line 12
Namespace
Drupal\workflowsView source
interface StateInterface {
/**
* The key of the state plugin form.
*/
const PLUGIN_FORM_KEY = 'state';
/**
* Gets the state's ID.
*
* @return string
* The state's ID.
*/
public function id();
/**
* Gets the state's label.
*
* @return string
* The state's label.
*/
public function label();
/**
* Gets the state's weight.
*
* @return int
* The state's weight.
*/
public function weight();
/**
* Determines if the state can transition to the provided state ID.
*
* @param $to_state_id
* The state to transition to.
*
* @return bool
* TRUE if the state can transition to the provided state ID. FALSE, if not.
*/
public function canTransitionTo($to_state_id);
/**
* Gets the Transition object for the provided state ID.
*
* @param $to_state_id
* The state to transition to.
*
* @return \Drupal\workflows\TransitionInterface
* The Transition object for the provided state ID.
*
* @throws \InvalidArgumentException()
* Exception thrown when the provided state ID can not be transitioned to.
*/
public function getTransitionTo($to_state_id);
/**
* Gets all the possible transition objects for the state.
*
* @return \Drupal\workflows\TransitionInterface[]
* All the possible transition objects for the state.
*/
public function getTransitions();
}
Members
Title Sort descending | Modifiers | Object type | Summary | Overrides |
---|---|---|---|---|
StateInterface::canTransitionTo | public | function | Determines if the state can transition to the provided state ID. | 2 |
StateInterface::getTransitions | public | function | Gets all the possible transition objects for the state. | 2 |
StateInterface::getTransitionTo | public | function | Gets the Transition object for the provided state ID. | 2 |
StateInterface::id | public | function | Gets the state's ID. | 2 |
StateInterface::label | public | function | Gets the state's label. | 2 |
StateInterface::PLUGIN_FORM_KEY | constant | The key of the state plugin form. | ||
StateInterface::weight | public | function | Gets the state's weight. | 2 |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.