Advertisement
Guest User

Untitled

a guest
Dec 6th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. function my_module_views_query_alter(&$view, &$query) {
  2. if ($view->name == 'my_view') {
  3.  
  4. $node = node_load($nid);
  5. //setting a value from my actual node, into a variable
  6. $field_frequency = $node->field_frequency['und'][0]['value'];
  7.  
  8. //testing add where function:
  9. // $papa = $query->fields['nid']['field'];
  10. // $query->add_where(0, $papa , '17144', '=');
  11. // it works!!
  12. //time to compare the field frecuency from my actual node with all the fields from my view
  13.  
  14. $view_frecuency = $query->fields['field_data_field_frequency_node_entity_type']['field'];
  15. $query->add_where(0, $view_frecuency , $field_frequencyday, '=');
  16.  
  17.  
  18. }
  19.  
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement