I want to alter a query for sorting a field. I read the documentation, it says
This hook should be placed in MODULENAME.views.inc and it will be auto-loaded. MODULENAME.views.inc must be in the directory specified by the 'path' key returned by MODULENAME_views_api(), or the same directory as the .module file, if 'path' is unspecified.
I used to implement all hooks inside my sites/default/realia/template.php so I first went stright and implemented the hook in sites/default/realaia/template.php which obviously didnt work.
function realia_views_query_alter(&$view, &$query) {
print "<h1>I am in alter query</h1>";
var_dump($query);
}
After reading doc carefully which says the hook needs to be placed inside the specific file and in a specific place I totally feel lost. Because I don't see any .module file in my sites/default/themes/realia. This is where my all files provided by realia (3rd party) are placed there is only .info file but no .module file.
There are also other related modules inside sites/all/modules/realia but looks like this folder is not a module itself becuse there are no .info or .module files inside the root but subfolders/modules has it. I went and created a file reala_submodule.views.inc with the implementation and placed one in each of the modules but I still dont see it really got executed ever.
Of course I did drush cc all every time whenever I doubted there could be caching issue. I will have followup questions related sorting once I get this implementation working. Please help.