You are here

function _search_by_page_setup_theme in Search by Page 7

Same name and namespace in other branches
  1. 8 search_by_page.module \_search_by_page_setup_theme()

Sets up the right theme to use for theming this page.

2 calls to _search_by_page_setup_theme()
search_by_page_page_content in ./search_by_page.module
Returns the content portion of the rendered page at the given path.
search_by_page_update_index in ./search_by_page.module
Implements hook_update_index().

File

./search_by_page.module, line 558
Main module file for Drupal module Search by Page.

Code

function _search_by_page_setup_theme() {

  // This basically follows drupal_theme_initialize(), but assumes all the
  // bootstrap stuff has been done, and skips AJAX/JS stuff.
  global $user;
  global $theme;
  global $theme_key;
  $themes = list_themes();
  $theme = !empty($user->theme) && drupal_theme_access($user->theme) ? $user->theme : variable_get('theme_default', 'bartik');
  drupal_static_reset('menu_get_custom_theme');
  $custom_theme = menu_get_custom_theme(TRUE);
  $theme = !empty($custom_theme) ? $custom_theme : $theme;
  $theme_key = $theme;
  $base_theme = array();
  $ancestor = $theme;
  while ($ancestor && isset($themes[$ancestor]->base_theme)) {
    $ancestor = $themes[$ancestor]->base_theme;
    $base_theme[] = $themes[$ancestor];
  }
  _drupal_theme_initialize($themes[$theme], array_reverse($base_theme));
  drupal_static_reset('drupal_alter');
}