By Sam Dark on
Hello, Drupal community,
I've faced a problem theming Views in a module, not in a theme. Need it to provide default look and feel for a view provided by the same module.
I've learned how to do it using views-view-field--product-list--title.tpl.php and other theme files in a custom theme directory and it works good but no luck with moving it to the module.
I've tried to use theme_registry_alter hook, but it made no difference and views-view-field--product-list--title.tpl.php was not read from module's tpl directory.
Here is my code:
function compare_theme_registry_alter(&$theme_registry){
$originalpath = array_shift($theme_registry['views_view_field']['theme paths']);
$modulepath = drupal_get_path('module', 'compare') .'/tpl';
array_unshift($theme_registry['views_view_field']['theme paths'], $modulepath, $originalpath);
dsm($theme_registry);
}
Comments
Hi Sam, Did you end up
Hi Sam,
Did you end up working this one out? I too am interested in theming views from a module. Glad I'm not the only one!
Hey Sam, Check out the Image
Hey Sam, Check out the Image Browser module (2.x-dev) - it seems to accomplish the job, but with a bit more code.