You are here

function flag_lists_views_data in Flag Lists 7.3

Same name and namespace in other branches
  1. 6 includes/flag_lists.views.inc \flag_lists_views_data()
  2. 7 includes/flag_lists.views.inc \flag_lists_views_data()

Implementation of hook_views_data().

File

includes/flag_lists.views.inc, line 126
Provides support for the Views module.

Code

function flag_lists_views_data() {
  $data = array();

  // flag_lists_flags data
  $data['flag_lists_flags'] = array(
    'table' => array(
      'base' => array(
        'field' => 'fid',
        'title' => t('Flag lists'),
        'help' => 'User created flag lists',
        'weight' => 10,
        'database' => 'default',
      ),
      'group' => t('Flag lists'),
      'join' => array(
        'node' => array(
          'table' => 'flag_lists_flags',
          'left_table' => 'flag_lists_content',
          'left_field' => 'fid',
          'field' => 'fid',
        ),
      ),
    ),
    'fid' => array(
      'title' => t('fid'),
      'help' => t('Flag list id, required for Flag lists operationis\'s "unflag" action.'),
      'field' => array(
        'handler' => 'flag_lists_handler_field_list',
        'click sortable' => TRUE,
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_numeric',
        'allow empty' => TRUE,
      ),
      'argument' => array(
        'handler' => 'flag_lists_handler_argument_fid',
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
    ),
    'pfid' => array(
      'title' => t('pfid'),
      'help' => t('Template flag id'),
      'field' => array(
        'handler' => 'flag_lists_handler_field_pfid',
        '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',
      ),
    ),
    'uid' => array(
      'title' => t('Uid'),
      'help' => t('The list owner\'s uid'),
      // The help that appears on the UI,
      'field' => array(
        'handler' => 'views_handler_field_user',
        'click sortable' => TRUE,
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_user_uid',
        'name field' => 'name',
      ),
      'filter' => array(
        'title' => t('Name'),
        'handler' => 'views_handler_filter_user_name',
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
    ),
    'name' => array(
      'title' => t('machine name'),
      'help' => t('Machine name of the list'),
      'field' => array(
        'handler' => 'flag_lists_handler_field_list',
        'click sortable' => TRUE,
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_string',
        'allow empty' => TRUE,
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_string',
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
    ),
    'title' => array(
      'title' => t('List title'),
      'help' => t('Title of the list'),
      'field' => array(
        'click sortable' => TRUE,
        'handler' => 'flag_lists_handler_field_list',
      ),
      'filter' => array(
        'handler' => 'flag_lists_handler_filter_list',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_string',
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
    ),
    'edit_list' => array(
      'field' => array(
        'title' => t('Edit link'),
        'help' => t('Link to edit the list title'),
        'handler' => 'flag_lists_handler_field_list_edit',
      ),
    ),
    'delete_list' => array(
      'field' => array(
        'title' => t('Delete link'),
        'help' => t('Link to delete the list'),
        'handler' => 'flag_lists_handler_field_list_delete',
      ),
    ),
  );

  // Flag_lists_content data
  $data['flag_lists_content'] = array(
    'table' => array(
      'join' => array(
        'node' => array(
          'left_field' => 'nid',
          'field' => 'entity_id',
        ),
      ),
      'group' => t('Flag lists'),
    ),
    'uid' => array(
      'relationship' => array(
        'title' => t('User'),
        'help' => t('The user who listed this node'),
        'base' => 'users',
        'handler' => 'views_handler_relationship',
        'label' => t('List user'),
      ),
    ),
    'entity_id' => array(
      'relationship' => array(
        'title' => t('Node'),
        'help' => t('The node that has been listed'),
        'base' => 'node',
        'handler' => 'views_handler_relationship',
        'label' => t('Listed content'),
      ),
    ),
    'timestamp' => array(
      'title' => t('Time listed'),
      'help' => t('The time this node was listed'),
      'field' => array(
        'handler' => 'views_handler_field_date',
        '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',
      ),
    ),
  );

  // Flag_lists_types data
  $data['flag_lists_types'] = array(
    'table' => array(
      'group' => t('Flag lists'),
      'join' => array(
        'flag_lists_flags' => array(
          'table' => 'flag_lists_types',
          'type' => 'INNER',
          'left_table' => 'flag',
          'left_field' => 'name',
          'field' => 'name',
        ),
      ),
    ),
    'type' => array(
      'title' => t('Template types'),
      'help' => t('Node types that can be listed by lists using this template'),
      'field' => array(
        'click sortable' => FALSE,
        'handler' => 'flag_lists_handler_field_template_types',
      ),
    ),
  );
  return $data;
}