From b878ed174d9e8628098931156d526b3fc028d905 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 8 Dec 2008 06:14:34 +0000 Subject: Refactor Menu code to create allow you to create menus using a chainable factory interface and retrieve them by ids. Streamlined the HTML creation code a little bit in the process, moved the basic menu functionality into Theme_View and created the option to have different menus other than site_navigation(). --- core/libraries/Theme_View.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'core/libraries/Theme_View.php') diff --git a/core/libraries/Theme_View.php b/core/libraries/Theme_View.php index 1c388596..1ab57f4c 100644 --- a/core/libraries/Theme_View.php +++ b/core/libraries/Theme_View.php @@ -58,9 +58,20 @@ class Theme_View_Core extends View { } public function site_navigation() { - $menu = menus::get_menu_items($this)->__toString(); - Kohana::log("debug", sprintf("[%s%s] site_navigation: %s", __FILE__, __LINE__, $menu)); - return $menu; + $menu = new Menu(true); + core_menu::site_navigation($menu, $this); + + foreach (module::installed() as $module) { + if ($module->name == "core") { + continue; + } + $class = "{$module->name}_menu"; + if (method_exists($class, "site_navigation")) { + call_user_func_array(array($class, "site_navigation"), array(&$menu, $this)); + } + } + + print $menu; } public function pager() { -- cgit v1.2.3