You are here

function workflow_fields_nodeapi in Workflow Fields 5

File

./workflow_fields.module, line 329
This module adds to workflow.module the ability to specify, for each state, which node fields should be visible and/or editable. It is a useful feature when workflows demand that certain information be hidden or read-only to certain roles.

Code

function workflow_fields_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  if ($op == 'view') {
    $sid = workflow_node_current_state($node);
    list($visibles, $editables) = _workflow_fields_get_fields($sid, $node->type, $node);
    if (!isset($visibles)) {
      return;
    }
    foreach ($visibles as $key => $visible) {
      if (!$visible) {
        $node->content[$key]['#access'] = FALSE;
      }
    }
  }
}