function flag_lists_views_data_alter in Flag Lists 7
Same name and namespace in other branches
- 6 includes/flag_lists.views.inc \flag_lists_views_data_alter()
- 7.3 includes/flag_lists.views.inc \flag_lists_views_data_alter()
Implementation of hook_views_data_alter().
File
- includes/
flag_lists.views.inc, line 53 - Provides support for the Views module.
Code
function flag_lists_views_data_alter(&$data) {
// We want access to users table fields.
$data['users']['table']['join']['flag_lists_flags'] = array(
'left_field' => 'uid',
'field' => 'uid',
);
// We need fid and name form flags' data, and join.
$data['flags'] = array(
'table' => array(
'group' => t('Flag'),
'join' => array(
'flag_lists_flags' => array(
'left_field' => 'pfid',
'field' => 'fid',
),
),
),
'fid' => array(
'title' => t('Flag fid'),
'help' => t('Flag id'),
'field' => array(
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
'allow empty' => TRUE,
),
'argument' => array(
'handler' => 'views_handler_argument_numeric',
),
'sort' => array(
'handler' => 'views_handler_sort',
),
),
'name' => array(
'title' => t('Template name'),
'help' => t('The name of the list template flag'),
'field' => array(
'handler' => 'flag_lists_handler_field_template',
'click sortable' => TRUE,
),
'filter' => array(
'handler' => 'flag_lists_handler_filter_template',
'allow empty' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
),
);
// Add the checkbox for flagging nodes VBO style, minus batch API
foreach (entity_get_info() as $entity_type => $info) {
if (isset($info['base table']) && $info['base table'] == 'node' && isset($data[$info['base table']])) {
$data[$info['base table']]['flag_lists_ops'] = array(
'title' => t('Flag lists operations'),
'help' => t('Provide a checkbox to select the row for flag lists operations.'),
'real field' => $info['entity keys']['id'],
'field' => array(
'handler' => 'flag_lists_handler_field_ops',
'click sortable' => FALSE,
),
);
break;
}
}
}