function workflow_get_workflow_for_type in Workflow 6.2
Same name and namespace in other branches
- 5.2 workflow.module \workflow_get_workflow_for_type()
- 5 workflow.module \workflow_get_workflow_for_type()
- 6 workflow.module \workflow_get_workflow_for_type()
Get ID of a workflow for a node type.
Parameters
$type: Machine readable node type name, e.g. 'story'.
Return value
int The ID of the workflow or FALSE if no workflow is mapped to this type.
8 calls to workflow_get_workflow_for_type()
- workflow_field_choices in ./
workflow.module - Get the states current user can move to for a given node.
- workflow_form_alter in ./
workflow.module - Implementation of hook_form_alter().
- workflow_nodeapi in ./
workflow.module - Implementation of hook_nodeapi().
- workflow_node_current_state in ./
workflow.module - Get the current state of a given node.
- workflow_node_tab_access in ./
workflow.module - Menu access control callback. Determine access to Workflow tab.
File
- ./
workflow.module, line 702 - Support workflows made up of arbitrary states.
Code
function workflow_get_workflow_for_type($type) {
static $cache;
if (!isset($cache[$type])) {
$wid = db_result(db_query("SELECT wid FROM {workflow_type_map} WHERE type = '%s'", $type));
$cache[$type] = $wid;
}
else {
$wid = $cache[$type];
}
return $wid > 0 ? $wid : FALSE;
}