The file path of the module is set up like this:


The problem is I can not figure out how to set the path in the plugin definition for the View. If I set the 'theme path' key to drupal_get_path('module', 'addressfield'). '/views' the handlers will register but the themes can not be found and vis versa.

 * @file
 *  Provide the Addressfield plugin definition.

function addressfield_views_plugins() {
  $path = drupal_get_path('module', 'addressfield') . '/views';
  return array(
    'module' => 'addressfield',
    'style' => array(
      'jmapping' => array(
        'title' => t('jMapping'),
        'help' => t('Display a view jMapping map.'),
        'handler' => 'addressfield_plugin_style_jmapping',
        'theme' => 'addressfield_jmapping_view',
        'theme path' => $path,
        'uses row plugin' => TRUE,
        'uses options' => TRUE,
        'uses grouping' => TRUE,
        'type' => 'normal',
        'parent' => 'default',
    'row' => array(
      'jmappingfields' => array(
        'title' => t('jMapping Fields'),
        'help' => t('Choose the fields to display in the jMapping Map.'),
        'handler' => 'addressfield_plugin_row_jmappingfields',
        'theme' => 'addressfield_view_jmappingfields',
        'theme path' => $path,
        'uses fields' => TRUE,
        'uses options' => TRUE,
        'type' => 'normal',

How do I keep the theme templates for the style plugin and the handlers in separate folders for clarity?

I'm using Views 3 in Drupal 7.

  • To which Drupal version are you interested?
    – apaderno
    Apr 26, 2011 at 20:26
  • I'm using Views 3 in Drupal 7.
    – Adam S
    Apr 26, 2011 at 22:58

1 Answer 1


You should create an addressfield/theme/theme.inc that contains the template_preprocess_addressfield_* functions. Then add: $theme_path = drupal_get_path('module', 'addressfield') . '/theme'; at the top.

'handler' => 'addressfield_plugin_style_jmapping',
'path' => $path,
'theme' => 'addressfield_jmapping_view',
'theme path' => $theme_path,
'theme file' => 'theme.inc',

That should work just fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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