You are here

function workflow_access_workflow_operations in Workflow 7.2

Same name and namespace in other branches
  1. 8 modules/workflow_access/workflow_access.module \workflow_access_workflow_operations()
  2. 7 workflow_access/workflow_access.module \workflow_access_workflow_operations()

Implements hook_workflow_operations().

File

workflow_access/workflow_access.module, line 40
Provides node access permissions based on workflow states.

Code

function workflow_access_workflow_operations($op, $workflow = NULL, $state = NULL) {
  $admin_path = WORKFLOW_ADMIN_UI_PATH;
  switch ($op) {
    case 'workflow':
      $actions = array();
      if ($workflow && $workflow
        ->getStates()) {
        $wid = $workflow
          ->getWorkflowId();
        $alt = t('Control content access for @wf', array(
          '@wf' => $workflow
            ->getName(),
        ));
        $actions += array(
          'workflow_access_form' => array(
            'title' => t('Access'),
            'href' => "{$admin_path}/manage/{$wid}/access",
            'attributes' => array(
              'alt' => $alt,
              'title' => $alt,
            ),
          ),
        );
      }
      else {

        // Generate a dummy, if no states exist.
        $actions = array(
          'workflow_access_form' => array(
            'title' => '',
            'href' => '',
          ),
        );
      }
      return $actions;
  }
}