Make authorship available as a field in Views
Matt B - June 27, 2007 - 20:44
| Project: | Authorship Module |
| Version: | 5.x-1.1 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
I use the Views module on my site and need to show the Authorship field in the views. Adding the following function to authorship.module and clearing the Views cache did the trick!
function authorship_views_tables() {
$tables['node_authorship'] = array(
'join' => array(
'left' => array(
'table' => 'node',
'field' => 'nid',
),
'right' => array(
'field' => 'nid',
),
),
'fields' => array(
'authorship' => array(
'name' => t('Node: Authorship'),
'sortable' => true,
'help' => t('Display the authorship display setting for the node.'),
),
),
'sorts' => array(
'authorship' => array(
'name' => t('Node: Authorship'),
'help' => t('Sort by the node authorship, alphabetically'),
),
),
'filters' => array(
'authorship' => array(
'name' => t('Node: Authorship'),
'help' => t('Sort by the node authorship, alphabetically'),
),
),
);
return $tables;
}Hope this is of use...
Matt

#1
#2
Filters was not working - the following correction allows filetering on authorship:
'filters' => array('authorship' => array(
'name' => t('Node: Authorship'),
'operator' => 'views_handler_operator_like',
'handler' => 'views_handler_filter_like',
'help' => t('Sort by the node authorship, alphabetically'),
),
),
#3
Committed to Drupal-5 branch, thanks! : http://drupal.org/cvs?commit=71826
#4