You are here

function comment_goodness_theme_registry_alter in Comment goodness 7

Implements hook_theme_registry_alter().

Override the core comment-wrapper and comment template with the template in this module.

File

./comment_goodness.module, line 209
Comment goodness provides newest to oldest comment sorting

Code

function comment_goodness_theme_registry_alter(&$theme_registry) {
  if (isset($theme_registry['comment_wrapper'])) {
    $comment_wrapper = $theme_registry['comment_wrapper'];

    // If the current template belongs to the core comment module, replace it.
    if (isset($comment_wrapper['template']) && $comment_wrapper['template'] === 'modules/comment/comment-wrapper') {
      $path = drupal_get_path('module', 'comment_goodness');
      $theme_registry['comment_wrapper']['template'] = $path . '/templates/comment-wrapper';
    }
  }
  if (isset($theme_registry['comment'])) {
    $comment = $theme_registry['comment'];

    // If the current template belongs to the core comment module, replace it.
    if (isset($comment['template']) && $comment['template'] === 'modules/comment/comment') {
      $path = drupal_get_path('module', 'comment_goodness');
      $theme_registry['comment']['template'] = $path . '/templates/comment';
    }
  }
}