You are here

function shortcode_embed_contents_theme_registry_alter in Shortcode 6

Same name and namespace in other branches
  1. 7 shortcode_embed_contents/shortcode_embed_contents.module \shortcode_embed_contents_theme_registry_alter()

Implementation of hook_theme_registry_alter This is where we add our default template for the fckeditor view page template. We want our path suggestion for the module to be overridden by the theme, so some re-ordering is needed.

File

shortcode_embed_contents/shortcode_embed_contents.module, line 116

Code

function shortcode_embed_contents_theme_registry_alter(&$theme_registry) {
  $paths = $theme_registry['node']['theme paths'];
  $theme = $theme_registry['page']['theme path'];

  //dpr($theme_registry,FALSE, 'theme');

  /*

      PATHS => Array
      (
          [0] => modules/system
          [1] => sites/all/themes/ninesixty
          [2] => sites/all/themes/internode
      )

     *
    // */

  //drupal_set_message($theme);

  // sites/all/themes/internode
  $key = array_search($theme, $paths);
  if ($key === FALSE) {
    $theme_registry['node']['theme paths'][] = drupal_get_path('module', 'shortcode_embed_contents') . "/theme";
  }
  else {

    //dpr($theme_registry['node']['theme paths'],FALSE, 'PATHS');
    $paths = array();
    $first = TRUE;
    foreach ($theme_registry['node']['theme paths'] as $path) {
      if ($first && preg_match('!themes!', $path)) {
        $paths[] = drupal_get_path('module', 'shortcode_embed_contents') . "/theme";
        $first = FALSE;
      }
      $paths[] = $path;
    }
    $theme_registry['node']['theme paths'] = $paths;

    //dpr($theme_registry['node']['theme paths'],FALSE, 'PATHS');

    /*
          PATHS => Array
          (
              [0] => modules/system
              [1] => sites/all/themes/ninesixty
              [2] => sites/all/modules/shortcode/shortcode_embed_contents/theme
              [3] => sites/all/themes/internode
          )

        // */
  }
}