function _jeditable_workflow_save in jEditable inline content editing 7
Same name and namespace in other branches
- 6.2 jeditable.module \_jeditable_workflow_save()
- 6 jeditable.module \_jeditable_workflow_save()
Set the workflow state of the node
Parameters
object $node: Node to be changed.
Return value
string the status name after state change.
1 call to _jeditable_workflow_save()
- _jeditable_ajax_save in ./
jeditable.module - Helper function to save a value using the jeditable callback
File
- ./
jeditable.module, line 755 - jeditable.module TODO: Provides integration between Drupal and the jEditable jquery plugin @todo: Datepicker support @todo: Ajax upload support @todo: Radioboxes/checkboxes support @todo: add required handler for date @todo: add compatibility for…
Code
function _jeditable_workflow_save($node, $sid) {
if ($sid == $node->_workflow) {
// this means there's nothing to change, so we just return the title
return workflow_get_state_name($sid);
}
else {
// here's where we do the actual transition. It will fail if user does not have appropriate permissions.
$new_sid = workflow_execute_transition($node, $sid, 'set using jeditable at ' . $_SERVER['HTTP_REFERER']);
}
if (empty($new_sid)) {
// in this case, the transition failed, so we'll return "access denied"
return "access denied";
}
// finally, this is the intended outcome and we can return the changed state's name
return workflow_get_state_name($new_sid);
}