You are here

function profile_views_data_alter in Profile 8

Implements hook_views_data_alter().

Adds a relationship from the user table to its' profile entity.

File

./profile.module, line 216
Support for configurable user profiles.

Code

function profile_views_data_alter(&$data) {
  $data['users_field_data']['profile']['relationship'] = [
    'title' => t('Profile'),
    'label' => t('Profile'),
    'group' => 'User',
    'help' => t('Reference to the profile of a user.'),
    'id' => 'standard',
    'base' => 'profile',
    'base field' => 'uid',
    'field' => 'uid',
  ];
  $data['users_field_data']['profile_type']['relationship'] = [
    'title' => t('Profile Type'),
    'label' => t('Profile Type'),
    'group' => 'User',
    'help' => t('Reference to a specific profile type of a user.'),
    'id' => 'profile_relationship',
    'base' => 'profile',
    'base field' => 'uid',
    'field' => 'uid',
  ];
}