Override a node template suggestion with template in custom module We have a content type that is added to the drupal system Programmatically when we install one of our custom modules. Essentially the module handle incoming property data from a 3rd party and creates a node entity for each property.

The content type created is named properties and as such its template suggestion shown in Twig debugging is node--properties--full.html.twig, see below:



I am creating a second custom module called lrg_property_display and my intention is that this module will handle all the rendering related functionality as I want to keep the API import related functionality separate from the rendering. My module structure is shown below:



I have created my module and followed a couple sites suggestions that I simply create a template file in my module and in the .module file implement the HOOK_THEME method, which I have done as shown:

function lrg_property_display_theme($existing, $type, $theme, $path)
{
    $theme['node__property_display__full'] = [
        'template' =&gt; 'node--property-display--full',
        'base hook' =&gt; 'node'
    ];

    return $theme;
}


Clearing cache and refreshing the page though is showing that the theme is not been applied.

Where am I going wrong with this please? I basically need the node--property-display--full.html.twig template within the module to be used whenever a node of the type Properties is viewed.

UPDATE

I added the following code to my theme file (Theme name is white_label) which seemed to produce an error which suggests it 'almost' works, albiet I'd prefer not having to do a suggestion in the theme but want it in the module. I can live with it though if this works for the short/medium term:

function white_label_theme($existing, $type, $theme, $path)
{
    return array(
        'node__properties__full' =&gt; array(
            'render element' =&gt; 'elements',
            'template' =&gt; 'node--property-display--full',
            'base hook' =&gt; 'node',
            'path' =&gt; drupal_get_path('module', 'lrg_property_display') . '/templates',
        )
    );
}


This then looks for the template node--property-display--full.html.twig but its looking in the main theme directory not in the module, even with the path specification.

The error returned was:

he website encountered an unexpected error. Please try again later.Twig_Error_Loader: Template "themes/custom/white_label/templates/nodes/node--property-display--full.html.twig" is not defined.


Reference image for comment in @Leigh's answer
Isn't your array key wrong? It should be:

 $theme['node__property__full'] = [
    'template' =&gt; 'node--property-display--full',
    'base hook' =&gt; 'node'
];


If you're wanting to target the "full" display and your content type has a machine name of "property"

I'm doing something similar targetting a node of type "news" and display node "teaser":

function mymodule_theme($existing, $type, $theme, $path) {
  return [
   'node__news__teaser' =&gt; [
      'template' =&gt; 'node--news--teaser',
      'base hook' =&gt; 'node'
    ],
  ];
}


And my folder structure is:

/modules/custom/mymodule/templates/node--news--teaser.html.twig