public function StateFlow::set_unpublished in State Machine 7
Same name and namespace in other branches
- 6 modules/state_flow/plugins/state_flow.inc \StateFlow::set_unpublished()
- 7.2 modules/state_flow/plugins/state_flow.inc \StateFlow::set_unpublished()
1 call to StateFlow::set_unpublished()
- StateFlow::on_exit_published in modules/
state_flow/ plugins/ state_flow.inc
File
- modules/
state_flow/ plugins/ state_flow.inc, line 214
Class
Code
public function set_unpublished() {
$this->object->status = 0;
// Set the unpublished status on the node_revision record for this revision
$res = db_update('node_revision')
->fields(array(
'status' => $this->object->status,
))
->condition('vid', $this->object->vid)
->execute();
// If the revision to unpublish is the latest published revision for the
// node, then unpublish the node itself
if ($this->object->vid == $this
->get_latest_revision($this->object->nid)) {
// Set the published status on the node record for this node
$res = db_update('node')
->fields(array(
'status' => $this->object->status,
))
->condition('nid', $this->object->nid)
->execute();
}
// Update the node access table for this node.
$node = node_load($this->object->nid, $this->object->vid, TRUE);
node_access_acquire_grants($node);
}