From 196aaa7d51b5ea9ac6422b93937b9070d5832272 Mon Sep 17 00:00:00 2001 From: Angie Byron Date: Sat, 30 Jan 2010 03:38:22 +0000 Subject: #553944 follow-up by David_Rothstein: Allow modules to override per-page custom themes. --- modules/system/system.api.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'modules/system/system.api.php') diff --git a/modules/system/system.api.php b/modules/system/system.api.php index 78cc24e2a..eefafdd74 100644 --- a/modules/system/system.api.php +++ b/modules/system/system.api.php @@ -1187,6 +1187,31 @@ function hook_theme_registry_alter(&$theme_registry) { } } +/** + * Return the machine-readable name of the theme to use for the current page. + * + * This hook can be used to dynamically set the theme for the current page + * request. It overrides the default theme as well as any per-page or + * per-section theme set by the theme callback function in hook_menu(). This + * should be used by modules which need to override the theme based on dynamic + * conditions. + * + * Since only one theme can be used at a time, the last (i.e., highest + * weighted) module which returns a valid theme name from this hook will + * prevail. + * + * @return + * The machine-readable name of the theme that should be used for the current + * page request. The value returned from this function will only have an + * effect if it corresponds to a currently-active theme on the site. + */ +function hook_custom_theme() { + // Allow the user to request a particular theme via a query parameter. + if (isset($_GET['theme'])) { + return $_GET['theme']; + } +} + /** * Register XML-RPC callbacks. * -- cgit v1.2.3