You are here

function spaces_views_data in Spaces 7

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. 6.2 includes/spaces.views.inc \spaces_views_data()
  4. 7.3 includes/spaces.views.inc \spaces_views_data()

Implements 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 43

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' => 'id',
    ),
    'users' => array(
      'left_field' => 'uid',
      'field' => 'id',
    ),
  );
  $data['spaces']['current'] = array(
    'title' => t('Content in current space'),
    'help' => t('Filters content to only those that belong to the 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'),
    'help' => t('Spaces feature associated with the current node.'),
    'field' => array(
      'field' => 'type',
      'handler' => 'spaces_handler_field_spaces_feature',
    ),
  );
  return $data;
}