public function Workflow::getNextSid in Workflow 7.2
Returns the next state for the current state.
Parameters
string $entity_type: The type of the entity at hand.
object $entity: The entity at hand. May be NULL (E.g., on a Field settings page).
$field_name:
$user:
bool $force:
Return value
int $sid A state ID.
Overrides WorkflowInterface::getNextSid
File
- includes/
Entity/ Workflow.php, line 439 - Contains workflow\includes\Entity\Workflow. Contains workflow\includes\Entity\WorkflowController.
Class
Code
public function getNextSid($entity_type, $entity, $field_name, $user, $force = FALSE) {
$new_sid = workflow_node_current_state($entity, $entity_type, $field_name);
if ($new_sid && ($new_state = workflow_state_load_single($new_sid))) {
/* @var $current_state WorkflowState */
$options = $new_state
->getOptions($entity_type, $entity, $field_name, $user, $force);
// Loop over every option. To find the next one.
$flag = $new_state
->isCreationState();
foreach ($options as $sid => $name) {
if ($flag) {
$new_sid = $sid;
break;
}
if ($sid == $new_state->sid) {
$flag = TRUE;
}
}
}
return $new_sid;
}