-
-
Save dawehner/6612021 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Implements hook_views_data_alter(). | |
*/ | |
function feature_user_views_data_alter(&$data) { | |
// Actions | |
$data['users']['profession'] = array( | |
'title' => t('Profession'), | |
'help' => t('Profession of a user'), | |
'field' => array( | |
'handler' => 'views_handler_field_user_profession', | |
), | |
'filter' => array( | |
'handler' => 'views_handler_filter_string', | |
), | |
// This will show a term relationship on a user view | |
'relationship' => array( | |
'handler' => 'views_handler_relationship', | |
'base' => 'taxonomy_term_data', | |
'base field' => 'tid', | |
), | |
); | |
// If you need to join automatically use that | |
$data['taxonomy_term_data']['table']['join']['users'] = array( | |
'field' => 'tid', | |
'left_field' => 'profession', | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment