menu_get_custom_theme

Versions
7
menu_get_custom_theme($initialize = FALSE)

Gets the custom theme for the current page, if there is one.

See also

menu_set_custom_theme()

Parameters

$initialize This parameter should only be used internally; it is set to TRUE in order to force the custom theme to be initialized from the menu router item for the current page.

Return value

The machine-readable name of the custom theme, if there is one.

Related topics

▾ 3 functions call menu_get_custom_theme()

drupal_theme_initialize in includes/theme.inc
Initialize the theme system by loading the theme.
menu_set_custom_theme in includes/menu.inc
Sets a custom theme for the current page, if there is one.
menu_test_theme_page_callback in modules/simpletest/tests/menu_test.module
Page callback to use when testing the theme callback functionality.

Code

includes/menu.inc, line 1500

<?php
function menu_get_custom_theme($initialize = FALSE) {
  $custom_theme = &drupal_static(__FUNCTION__);
  // Skip this if the site is offline or being installed or updated, since the
  // menu system may not be correctly initialized then.
  if ($initialize && !_menu_site_is_offline(TRUE) && (!defined('MAINTENANCE_MODE') || (MAINTENANCE_MODE != 'update' && MAINTENANCE_MODE != 'install'))) {
    $router_item = menu_get_item();
    if (!empty($router_item['access']) && !empty($router_item['theme_callback']) && function_exists($router_item['theme_callback'])) {
      $custom_theme = call_user_func_array($router_item['theme_callback'], $router_item['theme_arguments']);
    }
  }
  return $custom_theme;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.