Created
March 15, 2017 17:49
-
-
Save kitikonti/304dee044654118e0180f917b5f44a50 to your computer and use it in GitHub Desktop.
view connect table
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_query_alter(). | |
*/ | |
function mh_search_wish_views_query_alter(&$view, &$query) { | |
if ($view->name == 'matching_search_clients') { | |
$join = new views_join(); | |
$join->table = 'search_wish_hit_status'; | |
$join->field = 'profile_nid'; | |
$join->left_table = 'node'; | |
$join->left_field = 'nid'; | |
$join->type = 'left'; | |
$query->add_relationship('hit_status_relation', $join, 'node'); | |
$query->add_where(0, 'hit_status', 'offered', '='); | |
// if i do the add field here my view displays now results | |
// $query->add_field('search_wish_hit_status', 'hit_status', 'Hit status'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment