From 625d0785572af319b22a523550145b4dacbd6100 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Sun, 4 Jan 2009 07:40:37 +0000 Subject: Extend Theme_View to look in modules for photo and album menus. Move "view comments" link to the comment menu helper. --- core/helpers/core_menu.php | 9 ++------- core/libraries/Theme_View.php | 20 ++++++++++++++++++++ modules/comment/helpers/comment_menu.php | 9 +++++++++ 3 files changed, 31 insertions(+), 7 deletions(-) diff --git a/core/helpers/core_menu.php b/core/helpers/core_menu.php index 8a17d030..f9f6dbb0 100644 --- a/core/helpers/core_menu.php +++ b/core/helpers/core_menu.php @@ -79,7 +79,7 @@ class core_menu_Core { ->url("#") ->css_id("gHybridLink")); } - + public static function photo($menu, $theme) { $menu ->append(Menu::factory("link") @@ -87,18 +87,13 @@ class core_menu_Core { ->label(_("View full size image")) ->url("#") ->css_id("gFullsizeLink")) - ->append(Menu::factory("link") - ->id("comments") - ->label(_("View comments on this item")) - ->url("#comments") - ->css_id("gCommentsLink")) ->append(Menu::factory("link") ->id("album") ->label(_("View album hybrid mode")) ->url("#") ->css_id("gAlbumLink")); } - + public static function admin($menu, $theme) { $menu ->append(Menu::factory("link") diff --git a/core/libraries/Theme_View.php b/core/libraries/Theme_View.php index 37629f3d..8031b9af 100644 --- a/core/libraries/Theme_View.php +++ b/core/libraries/Theme_View.php @@ -79,6 +79,16 @@ class Theme_View_Core extends View { $menu = new Menu(true); core_menu::album($menu, $this); + foreach (module::installed() as $module) { + if ($module->name == "core") { + continue; + } + $class = "{$module->name}_menu"; + if (method_exists($class, "album")) { + call_user_func_array(array($class, "album"), array(&$menu, $this)); + } + } + print $menu; } @@ -86,6 +96,16 @@ class Theme_View_Core extends View { $menu = new Menu(true); core_menu::photo($menu, $this); + foreach (module::installed() as $module) { + if ($module->name == "core") { + continue; + } + $class = "{$module->name}_menu"; + if (method_exists($class, "photo")) { + call_user_func_array(array($class, "photo"), array(&$menu, $this)); + } + } + print $menu; } diff --git a/modules/comment/helpers/comment_menu.php b/modules/comment/helpers/comment_menu.php index 2cc6d789..6b17f57f 100644 --- a/modules/comment/helpers/comment_menu.php +++ b/modules/comment/helpers/comment_menu.php @@ -25,4 +25,13 @@ class comment_menu_Core { ->label(_("Comments")) ->url("#")); } + + public static function photo($menu, $theme) { + $menu + ->append(Menu::factory("link") + ->id("comments") + ->label(_("View comments on this item")) + ->url("#comments") + ->css_id("gCommentsLink")); + } } -- cgit v1.2.3