You are here

workflow_views.module in Workflow 7

Provide views integration for workflows. Why it's own module? Some sites have views some don't, all prefer a lower code footprint and better performance.

File

workflow_views/workflow_views.module
View source
<?php

/**
 * @file
 * Provide views integration for workflows.
 * Why it's own module? Some sites have views some don't,
 * all prefer a lower code footprint and better performance.
 */

/**
 * Implements hook_permission().
 */
function workflow_views_permission() {
  return array(
    'access workflow summary views' => array(
      'title' => t('Access workflow summary views'),
      'description' => t('Access workflow summary views.'),
    ),
  );
}

/**
 * Implements hook_views_api().
 */
function workflow_views_views_api() {
  return array(
    'api' => 2,
    'path' => drupal_get_path('module', 'workflow_views') . '/includes',
  );
}

/**
 * Helper function, to gather the workflow name from a given arguement.
 */
function _workflow_views_get_workflow_state_name($sid) {
  if (empty($sid)) {
    return t('No state');
  }
  $output = t('Unknown state');
  if ($state = WorkflowState::load($sid)) {
    $name = $state
      ->getName();
    $output = !empty($name) ? check_plain($name) : $output;
  }
  return $output;
}

Functions

Namesort descending Description
workflow_views_permission Implements hook_permission().
workflow_views_views_api Implements hook_views_api().
_workflow_views_get_workflow_state_name Helper function, to gather the workflow name from a given arguement.