views:

175

answers:

1

I have a created a view (lets call it my_view).

In the theme: information section if the view I have noted one of the suggested template names (views-view--my-view--default.tpl.php (or close to that)), and created my own template file with that name.

This all works fine and when I visit the theme registry, I can see there is a hook there with the name of the template (views-view--my-view--default). However this hook has a type field of 'engine' rather than 'module'. I assume this is to do view the way views works out its own theming?

I want to implement hook_registry_alter to modify this theme hook (and others created in the same way), but I cant work out how to retrieve a list of these hooks.

I tried using array_keys(views_theme()) to get all the views hooks back but this list doesn't contain hooks created by over-riding template files. It only contains the default hooks like views_views_field etc

Is there a way to bring back a list of views theme hooks over-ridden in this way?

+1  A: 

I answer here as your last comment seems to indicate you are not interested anymore in pursuing your initial approach, and 600 chars would not be enough, anyhow.

An alternative approach to achieve what you want could be to use the "inheritance" of sub-themes from their parent theme. You could in other words define your user theme as a sub-theme of the admin theme.

In this way the theming engine would search for templates - in the case of a user viewing the site through the user theme - first in the user theme folder, then in the admin theme folder, and then in the module directory.

This is for example the same mechanism used by zen for letting you create your themes with the starter kit.

Hope this helps!

mac
Thanks for that suggestion. Unfortunately my use case is a little unusual as the view is displayed in the admin theme, yet I still want the theme system to look first for view templates in the default theme, then the admin theme.
grahamu
@granhamu - How different are the two themes? Is merging them into a single one and inserting some role-based logic in the theme function an option? While I am sure there are ways to achieve what you want (if not with Drupal at least by using PHP directly) drupal is designed to keep themes apart and what you want/need to do seems to go in the opposite direction (if I got you right: you want to force a theme to use pieces of another, unrelated one).
mac
@granhamu - In the above comment I assumed that you **always** have a "backup template" in the admin theme, but you want to use it only if the user theme does not have any alternative one. If that is not the case (i.e.: the admin theme only have templates when the user theme does not) then the solution is obvious: **just take my original answer and swap the hierarchy logic: make the admin theme a sub-theme of the user one**.
mac