You are here

function spaces_views_data in Spaces 6.2

Same name and namespace in other branches
  1. 6.3 includes/spaces.views.inc \spaces_views_data()
  2. 6 includes/spaces.views.inc \spaces_views_data()
  3. 7.3 includes/spaces.views.inc \spaces_views_data()
  4. 7 includes/spaces.views.inc \spaces_views_data()

Implementation of hook_views_data(). Adds a meta-filter that provides a layer of abstraction that delegates actual filtering to the implementing space type modules.

File

includes/spaces.views.inc, line 48

Code

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

  // This defines a fake "pseudo" table.
  $data['spaces']['table']['group'] = t('Spaces');
  $data['spaces']['table']['join'] = array(
    'node' => array(
      'left_field' => 'nid',
      'field' => 'sid',
    ),
    'users' => array(
      'left_field' => 'uid',
      'field' => 'sid',
    ),
  );
  $data['spaces']['current'] = array(
    'title' => t('Node in current space'),
    'help' => t('Posts in current space.'),
    'filter' => array(
      'handler' => 'spaces_handler_filter_spaces_current',
    ),
  );
  $data['spaces']['users_current'] = array(
    'title' => t('User in current space'),
    'help' => t('Users in current space.'),
    'filter' => array(
      'handler' => 'spaces_handler_filter_spaces_current',
    ),
  );

  // Pseudo node table
  $data['spaces_node']['table']['group'] = t('Spaces');
  $data['spaces_node']['table']['join'] = array(
    'node' => array(
      'table' => 'node',
      'left_field' => 'nid',
      'field' => 'nid',
    ),
  );
  $data['spaces_node']['feature'] = array(
    'title' => t('Spaces feature'),
    'field' => array(
      'field' => 'type',
      'handler' => 'spaces_handler_field_spaces_feature',
    ),
  );
  return $data;
}