I have a custom module that uses a couple of view hooks, and in 8.2.x I had them in my_module.views_execution.inc, in my module root directory. However, with the update to 8.3, my hooks are not being found. I'm looking at the 8.3 docs, but the incredibly verbose hooks overview page doesn't mention it, and neither does the page with the list of hooks.

So where do my view hooks need to be placed in 8.3 so they can be found?


I was finally able to get the hooks working again by putting them in the my_module.module file. I thought I read about that when I was first implementing these hooks when the site was still in 8.2, but it worked in the views_exection.incfile and not .module then. I haven't been able to find any documentation on this change so far, so if anyone could shed some light on it, I'd appreciate it.

| improve this answer | |
  • 2
    All the core modules still use *.views_execution.inc in 8.3.2, I wonder if it's the particular hooks that are no longer classed as execution hooks or something? – Clive Jun 6 '17 at 23:10
  • I just solved a similar problem but I had it in reverse of yours. my hook was in views.inc and it only works after I clear cache, for any regular page load, it didnt fire. I renamed it to views_execution.inc and now it is all back to normal. – aFeijo Oct 12 '18 at 20:36

I just used query_alter in module.views_execution.inc in a Drupal 8.7 installation and it ran fine. So there shouldn't be any change for the behavior of module.views_execution.inc location.

The API documentation seems to show the same as well


| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.