You are here

function flag_lists_views_data_alter in Flag Lists 6

Same name and namespace in other branches
  1. 7.3 includes/flag_lists.views.inc \flag_lists_views_data_alter()
  2. 7 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',
      ),
    ),
  );
}