You are here

function page_theme_custom_theme in Page Theme 7

Same name and namespace in other branches
  1. 7.2 page_theme.module \page_theme_custom_theme()

Implements hook_custom_theme().

File

./page_theme.module, line 125
This module allows to use different themes than the site default on specific pages.

Code

function page_theme_custom_theme() {
  $path = drupal_strtolower(drupal_get_path_alias($_GET['q']));
  $result = db_query('SELECT theme, pages FROM {page_theme} WHERE status = 1 ORDER BY weight, theme');
  foreach ($result as $page_theme) {
    $pages = drupal_strtolower($page_theme->pages);
    $page_match = drupal_match_path($path, $pages);
    if ($path != $_GET['q']) {
      $page_match = $page_match || drupal_match_path($_GET['q'], $pages);
    }
    if ($page_match) {
      return $page_theme->theme;
    }
  }
}