From f3981bbaa9c9e72d147e164a3decea411b6dd54c Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sat, 28 Nov 2009 23:25:07 -0800 Subject: Rework the theme loading code to allow themes to be treated as Gallery modules, and have an admin subdirectory that is treated like a Kohana module (as distinct from a Gallery module). The main advantage of creating the separate admin subdirectory is that we will not load an admin theme and a site theme at the same time. We'll only load a few specialized bits of the site theme while the admin theme is active. Concrete examples. A site theme named "xxx": - will receive events at themes/xxx/helpers/xxx_event.php - will have working controllers at themes/xxx/controllers/xxx.php If theme xxx has an admin subdir, then in admin mode it: - will receive events at themes/xxx/admin/helpers/xxx_event.php - will have working controllers at themes/xxx/admin/controllers/xxx.php --- modules/gallery/helpers/module.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'modules/gallery/helpers/module.php') diff --git a/modules/gallery/helpers/module.php b/modules/gallery/helpers/module.php index e6c196ce..50abdaae 100644 --- a/modules/gallery/helpers/module.php +++ b/modules/gallery/helpers/module.php @@ -335,6 +335,21 @@ class module_Core { call_user_func_array(array($class, $function), $args); } } + + // Give the admin theme a chance to respond, if we're in admin mode. + if (theme::$is_admin) { + $class = theme::$admin_theme_name . "_event"; + if (method_exists($class, $function)) { + call_user_func_array(array($class, $function), $args); + } + } + + // Give the site theme a chance to respond as well. It gets a chance even in admin mode, as + // long as the theme has an admin subdir. + $class = theme::$site_theme_name . "_event"; + if (method_exists($class, $function)) { + call_user_func_array(array($class, $function), $args); + } } /** -- cgit v1.2.3