0

I'm trying to override default views templates using _theme_process_registry() function. It's ok, but i've got some trouble when administrator trying to redefine output via views_ui interface. When he creates a new template, he obviously starts from default views templates (views/theme folder), so my templates is lost.

I'm trying to do so:

$theme_path = drupal_get_path('module', 'mymodule') . '/theme/default_templates';


/**
 * List all plugins trying to find overriden in our work directory
 */
foreach($plugins as $group_name => $plugins_group) {
    foreach ($plugins_group as $plugin_name => $plugin) {
        if (isset($plugin['theme']) && file_exists($theme_path . '/' .  strtr($plugin['theme'], '_', '-') . '.tpl.php')) {
            $plugins[$group_name][$plugin_name]['theme path'] = $theme_path;
        }
    }
}

but single field template doesn't work, coz its hardcoded in view_plugin_display.inc

// Field templates aren't registered the normal way...and they're always
// this one, anyhow.
$output .= '<pre>' . check_plain(file_get_contents(drupal_get_path('module', 'views') . '/theme/views-view-field.tpl.php')) . '</pre>';

Is anybody know how to fully override views templates to my own module directory?

And the second. I need to create more semantic markup like on dev.twitter.com.

How to redefine classes_array to get rid of extra classes and div elements?

I'm using drupal 7 and views 3.

0

Are the templates that are overriding your templates included in a Theme? Themes always take precedence over modules, so any template in a theme will always override the corresponding template from a module. You may want to consider re-phrasing your question to reference the original issue you are solving with your template files.

If you are referring specifically to Views output with your desire to create semantic markup, I would suggest the Semantic Views module.

  • I think semantic views is perfectly okay, thx a lot :) – Oleg Sherbakov Feb 12 '12 at 16:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.