Problem/Motivation

When you theme VBO using views-bulk-operations-table.tpl.php it affects all VBO views. Novariable is passed to this template to differentiate between views ( defaults, page_1 etc)

Proposed resolution

Pass some views variables into this template so one can logically seperate theming for different views using VBO.

Comments

Chris Gillis’s picture

Component: Core » Documentation

The $view variable is available. It is an object that carries a lot of data. I tend to run a case statement on $view->name.

Note: this is not explained in the @file comment.

bojanz’s picture

Version: 6.x-3.x-dev » 6.x-1.x-dev
Category: feature » task

Updating version. Seems like we need some improvements done in this area (pass variables to allow multiple templates, document the basic variables in the template)

infojunkie’s picture

Category: task » feature

This issue has actually regressed since #1280776: Bring back "select all" checkbox because the VBO table template was not as flexible as the standard Drupal theme('table').

You suggestions as to what would be the ideal case for theming are welcome.

infojunkie’s picture

Component: Documentation » Theming
ksenzee’s picture

I know this post is pretty old, but in case anyone else needs to theme specific VBO views in D6, here's what I did. These instructions are specific to modules; it may actually be easier from a theme but I haven't tried it.

1. Create a template file named whatever you want (such as 'views-bulk-operations-table--grid.tpl.php'). The name doesn't matter. Put it in your module (or theme) directory.

2. Add your new file as a template suggestion in hook_preprocess_views_bulk_operations_table():

 function mymodule_preprocess_views_bulk_operations_table(&$variables) {
  if ($variables['view']->name == 'your view name' && $variables['view']->current_display == 'your display name') {
    $variables['template_files'][] = 'views-bulk-operations-table--grid';
  }
}

Make sure you leave off the .tpl.php part of the filename you used.

3. Let the theme system know it should use your module directory as one place to look for VBO template files. (This is the step that is probably unnecessary for themes.)

function mymodule_theme_registry_alter(&$theme_registry) {
  $theme_registry['views_bulk_operations_table']['theme paths'][] = drupal_get_path('module', 'mymodule'); 
}

Clear the theme registry and views should start using your template file for the particular display you wanted to theme.

kenorb’s picture

Issue summary: View changes

Is this still a problem in 7.x?

joelpittet’s picture

Status: Active » Closed (outdated)

Closing this as 6.x is no longer being maintained.