Following what reported in the documentation for hook_views_query_alter(), I created a file named alterform.views.inc
and put it into an enabled module called alterform
. I added the following code in alterform.views.inc
.but it doesn't work.
function alterform_views_query_alter(&$view, &$query) {
switch($view->name) {
case 'myViewName':
echo 'test test'; // test
$query->orderby[0] = "FIELD(node.type, 'story', 'page', 'productTypeC', 'productTypeD') ASC";
$query->orderby[1] = "node_title ASC";
break;
}
}
why doesn't it output "test test"? What's wrong with my code?
there is still no output of test and views. what's wrong with my code? thank you
alterform.views.inc
inside your module and you didn't do it?