You are here

function amazon_media_theme_registry_alter in Amazon Product Advertisement API 7

Same name and namespace in other branches
  1. 6 amazon_media/amazon_media.module \amazon_media_theme_registry_alter()
  2. 7.2 amazon_media/amazon_media.module \amazon_media_theme_registry_alter()

Implements hook_theme_registry_alter().

Because we aren't defining our own stuff here, just providing some high-specificity templates for theme_amazon_item, we'll add this module's directory to the list of paths to search for when finding amazon_item tpl's.

File

amazon_media/amazon_media.module, line 55
Provides additional behaviors and data type for amazon items which are DVDs, software, video games, music, etc.

Code

function amazon_media_theme_registry_alter(&$theme_registry) {
  $theme_registry['amazon_item']['theme path'] = drupal_get_path('module', 'amazon_media');
  if (!empty($theme_registry['amazon_item'])) {

    // We'll try our best to avoid stepping on theme template files.
    if (!empty($theme_registry['amazon_item']['theme_paths']) && count($theme_registry['amazon_item']['theme paths']) > 1) {
      $theme = array_pop($theme_registry['amazon_item']['theme paths']);
    }
    $theme_registry['amazon_item']['theme paths'][] = drupal_get_path('module', 'amazon_media');
    if (isset($theme)) {
      $theme_registry['amazon_item']['theme paths'][] = $theme;
    }
  }
}