workflow_extensions.views_default.inc in Workflow Extensions 6
Same filename and directory in other branches
Canned, ready-to-customise workflow-related views: 1) Workflow Dashboard: a state transition form for each node that is subject to workflow 2) Workflow History: a customisable view version of the Workflow module's built-in workflow history, node/%/workflow, with extra options such as "edit comment" links.
File
views/workflow_extensions.views_default.incView source
<?php
/**
* @file
* Canned, ready-to-customise workflow-related views:
* 1) Workflow Dashboard: a state transition form for each node that is subject
* to workflow
* 2) Workflow History: a customisable view version of the Workflow module's
* built-in workflow history, node/%/workflow, with extra options such as
* "edit comment" links.
*/
/**
* Implementation of hook_views_default_views().
*/
function workflow_extensions_views_default_views() {
$view = new view();
$view->name = 'workflow_dashboard';
$view->description = 'Workflow dashboard';
$view->tag = 'workflow extensions';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE;
$handler = $view
->new_display('default', 'Defaults', 'default');
$handler
->override_option('fields', array(
'title' => array(
'label' => 'Title',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
'sid' => array(
'label' => 'Current state',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'sid',
'table' => 'workflow_node',
'field' => 'sid',
'relationship' => 'none',
),
'state_change_form' => array(
'label' => 'State transition form',
'alter' => array(
'alter_text' => 0,
'text' => 'Here you go: [state_change_form]',
'make_link' => 0,
'path' => 'node',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'state_change_form',
'table' => 'workflow_node',
'field' => 'state_change_form',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
));
$handler
->override_option('sorts', array(
'nid' => array(
'order' => 'DESC',
'id' => 'nid',
'table' => 'node',
'field' => 'nid',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler
->override_option('filters', array(
'sid' => array(
'id' => 'sid',
'table' => 'workflow_node',
'field' => 'sid',
),
));
$handler
->override_option('access', array(
'type' => 'perm',
'perm' => 'access workflow summary views',
));
$handler
->override_option('cache', array(
'type' => 'none',
));
$handler
->override_option('items_per_page', 20);
$handler
->override_option('use_pager', '1');
$handler
->override_option('style_plugin', 'table');
$handler = $view
->new_display('page', 'Page', 'page_1');
$handler
->override_option('path', 'workflow-dashboard');
$handler
->override_option('menu', array(
'type' => 'normal',
'title' => 'Workflow dashboard',
'description' => 'Workflow dashboard',
'weight' => '0',
'name' => 'navigation',
));
$handler
->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$views[$view->name] = $view;
// Workflow history with editable state transition comments
$view = new view();
$view->name = 'workflow_history';
$view->description = 'Workflow state transition history across all nodes or a single node';
$view->tag = 'workflow extensions';
$view->view_php = '';
$view->base_table = 'node';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE;
/* Edit this to true to make a default view disabled initially */
$handler = $view
->new_display('default', 'Defaults', 'default');
$handler
->override_option('relationships', array(
'uid' => array(
'label' => 'State transitioner',
'required' => 1,
'id' => 'uid',
'table' => 'workflow_node_history',
'field' => 'uid',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler
->override_option('fields', array(
'nid' => array(
'label' => 'Nid',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 0,
'exclude' => 1,
'id' => 'nid',
'table' => 'node',
'field' => 'nid',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'hid' => array(
'label' => 'Hid',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'set_precision' => FALSE,
'precision' => 0,
'decimal' => '.',
'separator' => ',',
'prefix' => '',
'suffix' => '',
'exclude' => 1,
'id' => 'hid',
'table' => 'workflow_node_history',
'field' => 'hid',
'relationship' => 'none',
),
'stamp' => array(
'label' => 'Date & time',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'date_format' => 'medium',
'custom_date_format' => '',
'exclude' => 0,
'id' => 'stamp',
'table' => 'workflow_node_history',
'field' => 'stamp',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
'title' => array(
'label' => 'Title',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 1,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
'sid' => array(
'label' => 'Transitioned to',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 1,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'sid',
'table' => 'workflow_node_history',
'field' => 'sid',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
'name' => array(
'label' => 'By',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_user' => 1,
'overwrite_anonymous' => 0,
'anonymous_text' => '',
'exclude' => 0,
'id' => 'name',
'table' => 'users',
'field' => 'name',
'override' => array(
'button' => 'Override',
),
'relationship' => 'uid',
),
'comment' => array(
'label' => 'Transition comment',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => 'workflow-log/[hid]?destination=workflow-history/[nid]',
'link_class' => '',
'alt' => 'Edit this comment',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 1,
'empty_zero' => 0,
'exclude' => 0,
'id' => 'comment',
'table' => 'workflow_node_history',
'field' => 'comment',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
'edit_comment' => array(
'label' => 'Edit comment',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 1,
'empty_zero' => 0,
'text' => '',
'exclude' => 0,
'id' => 'edit_comment',
'table' => 'workflow_node_history',
'field' => 'edit_comment',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
));
$handler
->override_option('sorts', array(
'hid' => array(
'order' => 'DESC',
'id' => 'hid',
'table' => 'workflow_node_history',
'field' => 'hid',
'relationship' => 'none',
),
));
$handler
->override_option('arguments', array(
'nid' => array(
'default_action' => 'default',
'style_plugin' => 'default_summary',
'style_options' => array(
'count' => 1,
'override' => 0,
'items_per_page' => '25',
),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => 'Workflow history for "%1"',
'breadcrumb' => '',
'default_argument_type' => 'php',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'ignore',
'break_phrase' => 0,
'not' => 0,
'id' => 'nid',
'table' => 'node',
'field' => 'nid',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
'3' => 0,
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_fixed' => '',
'default_argument_user' => 0,
'default_argument_php' => ' return arg(1);',
'validate_argument_node_type' => array(
'page' => 0,
'resume' => 0,
'simplenews' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'1' => 0,
'3' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_node_flag_name' => '*relationship*',
'validate_argument_node_flag_test' => 'flaggable',
'validate_argument_node_flag_id_type' => 'id',
'validate_argument_user_flag_name' => '*relationship*',
'validate_argument_user_flag_test' => 'flaggable',
'validate_argument_user_flag_id_type' => 'id',
'validate_argument_php' => '',
'override' => array(
'button' => 'Override',
),
),
));
$handler
->override_option('filters', array(
'hid' => array(
'operator' => '>',
'value' => array(
'value' => '0',
'min' => '',
'max' => '',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'hid',
'table' => 'workflow_node_history',
'field' => 'hid',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
));
$handler
->override_option('access', array(
'type' => 'perm',
'perm' => 'access workflow summary views',
));
$handler
->override_option('cache', array(
'type' => 'none',
));
$handler
->override_option('title', 'Workflow history');
$handler
->override_option('items_per_page', 100);
$handler
->override_option('use_pager', '1');
$handler
->override_option('style_plugin', 'table');
$handler = $view
->new_display('page', 'Page', 'page_1');
$handler
->override_option('path', 'workflow-history');
$handler
->override_option('menu', array(
'type' => 'normal',
'title' => 'Workflow history',
'description' => 'Workflow history',
'weight' => '0',
'name' => 'navigation',
));
$handler
->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler = $view
->new_display('block', 'Block', 'block_1');
$handler
->override_option('block_description', 'Workflow history across all nodes or just the currently viewed node');
$handler
->override_option('block_caching', -1);
$views[$view->name] = $view;
return $views;
}
Functions
Name![]() |
Description |
---|---|
workflow_extensions_views_default_views | Implementation of hook_views_default_views(). |