You are here

function workflow_get_workflow_type_map_by_type in Workflow 7.2

Same name and namespace in other branches
  1. 7 workflow.node.type_map.inc \workflow_get_workflow_type_map_by_type()

Getss workflow_type_map for a type. On no record, FALSE is returned.

Currently this is a unique result but requests have been made to allow a node to have multiple workflows. This is trickier than it sounds as a lot of our processing code will have to be tweaked to account for multiple results. ALERT: If a node type is *not* mapped to a workflow it will be listed as wid 0. Hence, we filter out the non-mapped results.

See also

workflow_get_workflows_by_type()

4 calls to workflow_get_workflow_type_map_by_type()
workflownode_node_view in workflow_node/workflownode.module
Implements hook_node_view().
workflow_bundle_ctools_access_check in workflow_node/plugins/access/workflow_bundle.inc
Custom callback defined by 'callback' in the $plugin array.
workflow_get_workflows_by_type in ./workflow.module
Get a specific workflow, given a Node type. Only one workflow is possible per node type.
_workflownode_form_alter in workflow_node/workflownode.module
Helper function to implement hook_form_alter().

File

./workflow.node.type_map.inc, line 30
Node specific functions, remnants of nodeapi.

Code

function workflow_get_workflow_type_map_by_type($type) {
  static $map = array();
  if (!isset($map[$type])) {
    $results = db_query('SELECT type, wid FROM {workflow_type_map} WHERE type = :type AND wid <> 0', array(
      ':type' => $type,
    ));
    $map[$type] = $results
      ->fetchObject();
  }
  return $map[$type];
}