Advertisement
Guest User

Untitled

a guest
Oct 26th, 2016
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. function YOUR_MODULE_views_query_alter(&$view, &$query) {
  2. if ($view->name = 'YOUR_VIEW' && !empty($view->exposed_raw_input['YOUR_FIELD']) {
  3. $transliterated = transliteration_get($view->exposed_raw_input['YOUR_FIELD']);
  4. // Traverse through the 'where' part of the query.
  5. foreach ($query->where as &$condition_group) {
  6. foreach ($condition_group['conditions'] as &$condition) {
  7. // If this is the part of the query filtering on your field, change the
  8. // condition value to the transliterated string.
  9. if ($condition['field'] == 'YOUR FIELD') {
  10. $condition['value'] = $transliterated;
  11. }
  12. }
  13. }
  14. }
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement