4

I'm trying to alter the theme registry:

function comment_simplify_theme_registry_alter(&$theme_registry) {
  $module_path = drupal_get_path('module', 'comment_simplify') . '/tpl';
  $theme_registry['comment']['template'] = $module_path . '/comment';
  $theme_registry['comment']['theme path'] = $module_path;
  $theme_registry['comment_wrapper']['template'] = $module_path . '/comment-wrapper';
  $theme_registry['comment_wrapper']['theme path'] = $module_path;
}

Now this is what I have in theme registry:

comment_wrapper
  template: sites/all/modules/comment_simplify/tpl/comment-...
  path: themes/bartik/templates
  type: theme_engine
  theme path: sites/all/modules/comment_simplify/tpl
  render element: content

I want to know what the difference between path and theme path is.

4

From the hook_theme() docs:

  • path: Override the path of the file to be used. Ordinarily the module or theme path will be used, but if the file will not be in the default path, include it here. This path should be relative to the Drupal root directory.
  • theme path: (automatically derived) The directory path of the theme or module, so that it doesn't need to be looked up.
  • So if I want to override default comment module's tpls its enough to define template and path instead theme path? – Mohammad Ali Akbari May 8 '13 at 13:39
  • I think you'll need to set theme path as well if you're re-implementing a template file from another module (so the theme registry knows to look in your module path, not the comment module which originally implemented the hook). – Clive May 8 '13 at 14:22

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.