You are here

function workflow_notify_workflow_operations in Workflow 7.2

Same name and namespace in other branches
  1. 7 workflow_notify/workflow_notify.module \workflow_notify_workflow_operations()

Implements hook_workflow_operations().

File

workflow_notify/workflow_notify.module, line 32
Notify roles for Workflow state transitions.

Code

function workflow_notify_workflow_operations($op, Workflow $workflow = NULL) {
  $admin_path = WORKFLOW_ADMIN_UI_PATH;
  switch ($op) {
    case 'workflow':
      $actions = array();
      if ($workflow && $workflow
        ->getStates()) {
        $wid = $workflow
          ->getWorkflowId();
        $alt = t('Notify users about state changes.');
        $actions = array(
          'workflow_notify_settings' => array(
            'title' => t('Notifications'),
            'href' => "{$admin_path}/manage/{$wid}/notify",
            'attributes' => array(
              'alt' => $alt,
              'title' => $alt,
            ),
          ),
        );
      }
      else {

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