You are here

public function OgMembershipViewsController::views_data in Organic groups 7

Same name and namespace in other branches
  1. 7.2 includes/views/og.views.inc \OgMembershipViewsController::views_data()

Override views_data().

Overrides EntityDefaultViewsController::views_data

File

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

Class

OgMembershipViewsController
"OG membership" entity Views definitions.

Code

public function views_data() {
  $data = parent::views_data();
  $data['og_membership']['state']['filter'] = array(
    'handler' => 'og_handler_filter_group_state',
    'numeric' => TRUE,
    'allow empty' => FALSE,
    'help' => t('Select the state of the group.'),
  );
  $data['og_membership']['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',
    ),
  );

  // Improve relationship text.
  $data['og']['og_membership']['title'] = t('OG membership from OG group');
  $data['og']['og_membership']['help'] = t('The OG membership associated with OG group via the group ID.');
  $data['og']['og_membership']['relationship']['label'] = t('OG membership from OG group');
  $data['og_membership']['og_roles'] = array(
    'title' => t('OG user roles in group'),
    'help' => t('Show all the roles a user belongs to in a group. Requires a relationship to users to be present.'),
    // This is a dummy field, so point it to a real field that we need - the
    // group ID
    'real field' => 'gid',
    'field' => array(
      'handler' => 'og_handler_field_user_roles',
    ),
  );
  return $data;
}