public function Workflow::getStates in Workflow 7.2
Same name and namespace in other branches
- 7 includes/Entity/Workflow.php \Workflow::getStates()
Gets all states for a given workflow.
Parameters
mixed $all: Indicates to which states to return.
- TRUE = all, including Creation and Inactive;
- FALSE = only Active states, not Creation;
- 'CREATION' = only Active states, including Creation.
Return value
array An array of WorkflowState objects.
Overrides WorkflowInterface::getStates
6 calls to Workflow::getStates()
- Workflow::delete in includes/
Entity/ Workflow.php - Given a wid, delete the workflow and its data.
- Workflow::getCreationSid in includes/
Entity/ Workflow.php - Gets the ID of the initial state for a newly created entity.
- Workflow::getTransitions in includes/
Entity/ Workflow.php - @inheritdoc
- Workflow::isDeletable in includes/
Entity/ Workflow.php - Returns if the Workflow may be deleted.
- Workflow::isValid in includes/
Entity/ Workflow.php - Validate the workflow. Generate a message if not correct.
File
- includes/
Entity/ Workflow.php, line 473 - Contains workflow\includes\Entity\Workflow. Contains workflow\includes\Entity\WorkflowController.
Class
Code
public function getStates($all = FALSE, $reset = FALSE) {
if ($this->states === NULL || $reset) {
$this->states = $this->wid ? WorkflowState::getStates($this->wid, $reset) : array();
}
// Do not unset, but add to array - you'll remove global objects otherwise.
$states = array();
foreach ($this->states as $state) {
if ($all === TRUE) {
$states[$state->sid] = $state;
}
elseif ($all === FALSE && ($state
->isActive() && !$state
->isCreationState())) {
$states[$state->sid] = $state;
}
elseif ($all == 'CREATION' && ($state
->isActive() || $state
->isCreationState())) {
$states[$state->sid] = $state;
}
}
return $states;
}