Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if node property = x
- use this sort criteria
- else
- use this one
- /**
- * Implements hook_views_query_alter().
- */
- function HOOK_views_query_alter(&$view, &$query) {
- if ($view->name == 'view_name' && $view->current_display == 'page') {
- $query->orderby = array(
- array(
- 'field' => 'CASE WHEN node.property = x THEN node.y ELSE node.z END',
- 'direction' => 'ASC',
- )
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement