So I have a custom module that has boilerplate template code inside it. No problem there. So I following the Drupal Docs which says to create a service.yml file and turn debug on and caches off. Done.
Now i'm able to view the debug info in my browser which shows which template is being called. So I copy the file field.html.twig
and all its content's, create a new template that is 2 layers up from the suggested template names (field--parent-task.html.twig
), and paste the code in there. So far nothing has changed other than file name only.
Now however, when I attempt to reload the page and clear my caches, it still defaults to the most generic and default template. Why does it not load my more name specific code in my custom module? Do I need to make any changes inside the file itself before it will load it?
/theme/your_theme/templates
folder. They can only be read from a/module/module_name/templates
folder if they are returned from hook_theme. See Override theme template from module without implementing a theme as an example. – No Sssweat May 17 '19 at 13:56