You are here

public function OgViewsController::views_data in Organic groups 7

Override views_data().

Overrides EntityDefaultViewsController::views_data

File

includes/og.views.inc, line 17
Provides support for the Views module.

Class

OgViewsController
"Group" entity Views definition.

Code

public function views_data() {
  $data = parent::views_data();
  $data['og']['gid']['argument'] = array(
    'handler' => 'og_handler_argument_group_audience_gid',
  );
  $data['og']['etid'] = array(
    'title' => t('Entity id'),
    'help' => t('The numeric id of the entity.'),
    'field' => array(
      'handler' => 'views_handler_field_numeric',
      'click sortable' => TRUE,
    ),
    'sort' => array(
      'handler' => 'views_handler_sort',
    ),
    'filter' => array(
      'handler' => 'views_handler_filter_numeric',
    ),
    'argument' => array(
      'handler' => 'views_handler_argument_numeric',
    ),
  );
  $data['field_data_group_audience']['og_permissions'] = array(
    'group' => t('Group'),
    'title' => t('Group permissions'),
    'help' => t('Filter by group permissions.'),
    // This is a dummy field, so point it to a real field that we need - the
    // group ID
    'real field' => 'group_audience_gid',
    'field' => array(
      'handler' => 'og_handler_field_group_permissions',
    ),
  );
  $data['og_users_roles'] = array(
    'table' => array(
      'group' => t('OG user roles'),
      'join' => array(
        'og_membership' => array(
          'left_field' => 'gid',
          'field' => 'gid',
        ),
      ),
    ),
  );
  $data['og_users_roles']['rid'] = array(
    'title' => t('Role ID'),
    'help' => t('The OG role ID.'),
    // We provide a dummy field to show the roles a user is part of. See
    // 'og_membership - og_roles'.
    // @todo: Add sort and filter.
    'filter' => array(
      'handler' => 'og_handler_filter_group_roles',
    ),
  );
  return $data;
}