Drupal 8 – View page and Module Route conflict

I have a view that is a page and is set to show at this URL: /myView

I have a module that I am building and its router is set to run the controller at this URL: /myView

I am trying to do is override the view templates and store them in my module. I have so far got this to work, but views isn’t working as it should:

  • I have set it up for tabbed output and these suddenly disappear when the routing is set to /myView
  • When I try and override views-view-unformatted–myModule the whole thing fails. The page loads with no content, and when I inspect I see that the template was correctly identified in the module/templates folder BUT there is no output from the template.
  • If I am not routing via the module the tabs appear fine in this instance.

My first question: is there a conflict occurring between the module routing and the view?

Second question: How do I solve this? I would like to have a tabbed output of the view and have it show on a particular URL. I would also (as I thought it might be cleaner in D8) use the routing of the module to do what I need to in the controller – this could be adding scripts or such, but I would like this option open if possible. My primary aim however is simply to have the template files stored in a module and used by the view – currently (with module routing off) views-view-unformatted–myModule is getting referenced but returning no output. Other template files used in the view are fine (such as node__view__myModule) so I find this strange.

Is there a better ‘Drupal way’ to solve this in D8? I was trying to be good and use the system they had provided. Much obliged for any help.

Drupal version: 


Source: https://www.drupal.org/taxonomy/term/4/feed