function content_lock_views_data in Content locking (anti-concurrent editing) 6
Same name and namespace in other branches
- 8.2 content_lock.module \content_lock_views_data()
- 8 content_lock.module \content_lock_views_data()
- 6.2 views/content_lock.views.inc \content_lock_views_data()
- 7.3 views/content_lock.views.inc \content_lock_views_data()
- 7 views/content_lock.views.inc \content_lock_views_data()
- 7.2 views/content_lock.views.inc \content_lock_views_data()
Implementation of hook_views_data()
File
- views/
content_lock.views.inc, line 13 - This file handles views api definitions. We describe the table to Views module as well as other necessary stuff to integrate
Code
function content_lock_views_data() {
$data = array();
// Our group in Views UI
$data['content_lock']['table']['group'] = t('Content Lock');
// Our join type. Only with node table
$data['content_lock']['table']['join'] = array(
'node' => array(
'left_field' => 'nid',
'field' => 'nid',
),
'user' => array(
'left_field' => 'uid',
'field' => 'uid',
),
);
// Relationship. This might be useful
$data['content_lock']['nid'] = array(
'title' => t('Node locked'),
'help' => t('The node being locked'),
'relationship' => array(
'label' => t('Node locked'),
'base' => 'node',
'base field' => 'nid',
'skip base' => array(
'node',
),
),
);
$data['content_lock']['uid'] = array(
'title' => t('Lock Owner'),
'help' => t('The user locking the node'),
'relationship' => array(
'label' => t('Lock Owner'),
'base' => 'users',
'base field' => 'uid',
'skip base' => array(
'user',
),
),
);
// Our Handlers:
$data['content_lock']['persistent'] = array(
'title' => t('Is persistent'),
'help' => t('Whether this node has been persistently locked'),
'field' => array(
'handler' => 'views_handler_field_boolean',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_boolean_operator',
'label' => t('Persistent'),
'type' => 'yes-no',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
$data['content_lock']['timestamp'] = array(
'title' => t('Lock Date/Time'),
'help' => t('Timestamp of the lock'),
'field' => array(
'handler' => 'views_handler_field_date',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort_date',
),
'filter' => array(
'handler' => 'views_handler_filter_date',
),
);
$data['content_lock']['is_locked'] = array(
'title' => t('Is Locked'),
'help' => t('Whether the node is currently locked'),
'field' => array(
'handler' => 'views_handler_field_is_locked',
),
'sort' => array(
'handler' => 'views_handler_sort_is_locked',
),
'filter' => array(
'handler' => 'views_handler_filter_is_locked',
'click sortable' => TRUE,
),
);
return $data;
}