function Workflow::save in Workflow 7
Same name and namespace in other branches
- 7.2 includes/Entity/Workflow.php \Workflow::save()
Given information, update or insert a new workflow.
@deprecated: workflow_update_workflows() --> Workflow->save() @todo: implement Workflow->save()
File
- includes/
Entity/ Workflow.php, line 143 - Contains workflow\includes\Entity\Workflow.
Class
- Workflow
- @file Contains workflow\includes\Entity\Workflow.
Code
function save($create_creation_state = TRUE) {
if (isset($this->tab_roles) && is_array($this->tab_roles)) {
$this->tab_roles = implode(',', $this->tab_roles);
}
if (is_array($this->options)) {
$this->options = serialize($this->options);
}
if ($this->wid > 0 && Workflow::load($this->wid)) {
drupal_write_record('workflows', $this, 'wid');
}
else {
drupal_write_record('workflows', $this);
if ($create_creation_state) {
$state_data = array(
'wid' => $this->wid,
'state' => t('(creation)'),
'sysid' => WORKFLOW_CREATION,
'weight' => WORKFLOW_CREATION_DEFAULT_WEIGHT,
);
workflow_update_workflow_states($state_data);
// // @TODO consider adding state data to return here as part of workflow data structure.
// // That way we could past structs and transitions around as a data object as a whole.
// // Might make clone easier, but it might be a little hefty for our needs?
}
}
}