[development] Naming a module's view template

Earl Miles merlin at logrus.com
Mon Oct 11 04:45:01 UTC 2010


On 10/10/2010 3:49 PM, jeff at ayendesigns.com wrote:
> Checking to make sure I'm not having a 'moment' and forgetting
> something. This regards Views in D7, but I don't think this has changed
> since D6.
> 
> 
> I have my_module, and it is to have a file that in a non-module
> environment would be views-view-table--my-view--page-1.tpl.php
> 
> 
> In my_module/theme I created my_module-view-table--my-view--page-1.tpl.php
> 
> 
> In my_module.info I have files[] =
> theme/my_module-view-table--my-view--page-1.tpl.php
> 
> 
> The view displays with is table, but no amount of cache clearing seems
> to get this template file recognized.

The answer to this question lies in the advanced help for Views.

Getting your module to provide a theme template for a view is not
automatic. You must register this via hook_theme().


More information about the development mailing list