function profile_views_data
3.x profile.views.inc | profile_views_data() |
2.x profile.views.inc | profile_views_data() |
Implementation of hook_views_data()
Related topics
File
- modules/
profile.views.inc, line 16 - Provide views data and handlers for user.module
Code
function profile_views_data() {
// Define the base group of this table. Fields that don't
// have a group defined will go into this field by default.
$data['profile_values']['table']['group'] = t('Profile');
$data['profile_values']['table']['join'] = array(
'node' => array(
'left_table' => 'profile_values',
'left_field' => 'uid',
'field' => 'uid',
),
'users' => array(
'left_table' => 'profile_values',
'left_field' => 'uid',
'field' => 'uid',
),
);
$fields = profile_views_get_fields();
foreach ($fields as $field) {
$table_name = 'profile_values_' . str_replace('-', '_', $field->name);
$data[$table_name] = array(
'table' => array(
'group' => t('Profile'),
'join' => array(
'node' => array(
'table' => 'profile_values',
'left_table' => 'users',
'left_field' => 'uid',
'field' => 'uid',
'extra' => array(array('field' => 'fid', 'value' => $field->fid)),
),
'users' => array(
'table' => 'profile_values',
'left_field' => 'uid',
'field' => 'uid',
'extra' => array(array('field' => 'fid', 'value' => $field->fid)),
),
),
),
);
// All fields in the table are named 'value'.
$data[$table_name]['value'] = profile_views_fetch_field($field);
}
return $data;
}