public function Workflow::getCreationState in Workflow 8
Gets the initial state for a newly created entity.
Overrides WorkflowInterface::getCreationState
3 calls to Workflow::getCreationState()
- Workflow::getCreationSid in src/
Entity/ Workflow.php - Gets the ID of the initial state for a newly created entity.
- Workflow::getFirstSid in src/
Entity/ Workflow.php - Gets the first valid state ID, after the creation state.
- Workflow::save in src/
Entity/ Workflow.php - Given information, update or insert a new workflow.
File
- src/
Entity/ Workflow.php, line 266
Class
- Workflow
- Workflow configuration entity to persistently store configuration.
Namespace
Drupal\workflow\EntityCode
public function getCreationState() {
// First, find it.
if (!$this->creation_state) {
foreach ($this
->getStates(TRUE) as $state) {
if ($state
->isCreationState()) {
$this->creation_state = $state;
$this->creation_sid = $state
->id();
}
}
}
// Then, create it.
if (\Drupal::isConfigSyncing()) {
// Do not create the default state while configuration are importing.
}
elseif (!$this->creation_state) {
$state = $this
->createState(WORKFLOW_CREATION_STATE_NAME);
$this->creation_state = $state;
$this->creation_sid = $state
->id();
}
return $this->creation_state;
}