You are here

function hook_workflow in Workflow 7

Same name in this branch
  1. 7 workflow.api.php \hook_workflow()
  2. 7 workflow_admin_ui/workflow_admin_ui.api.php \hook_workflow()
Same name and namespace in other branches
  1. 8 workflow.api.php \hook_workflow()
  2. 7.2 workflow.api.php \hook_workflow()

Implements hook_workflow().

NOTE: This hook may reside in the implementing module or in a module.workflow.inc file.

Parameters

$op: The current workflow operation: 'transition permitted', 'transition pre' or 'transition post'.

$old_state: The state ID of the current state.

$new_state: The state ID of the new state.

$node: The node whose workflow state is changing.

$force: The caller indicated that the transition should be forced. (bool). This is only available on the "pre" and "post" calls.

$field: The field definition. This is used when saving a state change of a Workflow Field.

4 functions implement hook_workflow()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

workflow_access_workflow in workflow_access/workflow_access.workflow.inc
Implements hook_workflow().
workflow_actions_workflow in workflow_actions/workflow_actions.module
Implements hook_workflow().
workflow_notify_workflow in workflow_notify/workflow_notify.module
Implements hook_workflow().
workflow_rules_workflow in workflow_rules/workflow_rules.workflow.inc
Implements hook_workflow(). Invokes events, as defined in hook_rules_event_info().
7 invocations of hook_workflow()
Workflow::delete in includes/Entity/Workflow.php
Given a wid, delete the workflow and its data.
WorkflowState::deactivate in includes/Entity/WorkflowState.php
Deactivate a Workflow State, moving existing nodes to a given State.
WorkflowState::getOptions in includes/Entity/WorkflowState.php
Returns the allowed values for the current state.
WorkflowTransition::execute in includes/Entity/WorkflowTransition.php
Execute a transition (change state of a node). @deprecated: workflow_execute_transition() --> WorkflowTransition::execute().
workflow_delete_workflow_transitions_by_tid in ./workflow.module
Given a tid, delete the transition.

... See full list

File

./workflow.api.php, line 28
Hooks provided by the workflow module.

Code

function hook_workflow($op, $old_state, $new_state, $node, $force = FALSE, $field = NULL) {
  switch ($op) {
    case 'transition permitted':

      // The workflow module does nothing during this operation.
      // This operation occurs when the list of available transitions
      // is built. Your module's implementation could return FALSE
      // here and disallow the presentation of the choice.
      break;
    case 'transition pre':

      // The workflow module does nothing during this operation.
      // But your module's implementation of the workflow hook could
      // return FALSE here and veto the transition.
      break;
    case 'transition post':
      break;
    case 'transition delete':
      break;
  }
}