Guest User

Untitled

a guest
Jan 21st, 2019
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. SUBSTRING(node.title, 1, :node_title) = :node_title1
  2.  
  3. SUBSTRING(node.title, 1, 1) =REGEXP ('[0-9]')
  4.  
  5. function custom_views_query_alter(&$view, &$query){
  6.  
  7. $current_view=&$view;
  8.  
  9. switch($current_view->name){
  10.  
  11. case 'glossary':
  12.  
  13. if($query->where[0]['conditions'][0]['value'][':node_title1']=='0-9'){
  14. $query->where[0]['conditions'][0]['field']= "SUBSTRING(node.title, 1, 1) =REGEXP ('[0-9]')";
  15. echo "YES";
  16.  
  17. dpm($query->where);
  18. } } }
  19.  
  20. function custom_views_query_alter(&$view, &$query){
  21.  
  22. $current_view=&$view;
  23. switch($current_view->name){
  24.  
  25. case 'glossary':
  26. if($query->where){
  27.  
  28. if($query->where[0]['conditions'][0]['value'][':node_title1']=="0-9"){
  29. $query->where[0]['conditions'][0]['field'] = "SUBSTRING(node.title, 1, 1) REGEXP ('[0-9]')";
  30. dpm($query->where);
  31. }
  32.  
  33. }
  34. }
  35. }
Add Comment
Please, Sign In to add comment