diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2008-11-20 17:32:58 +0000 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2008-11-20 17:32:58 +0000 |
commit | b78cee63950479abfa78df37a03388007f332543 (patch) | |
tree | cfd7c24d31d76ef94702fe11ab6164adf88612d9 /core/libraries | |
parent | e2b040c6ae3797a5d6ec6c0f05f6bf3194e07c52 (diff) |
A look at away to allow modules to define html head contents (links and js) and also allow modules to contribute blocks to the layout.
Diffstat (limited to 'core/libraries')
-rw-r--r-- | core/libraries/Theme.php | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/core/libraries/Theme.php b/core/libraries/Theme.php index 4bd8237a..642bfb87 100644 --- a/core/libraries/Theme.php +++ b/core/libraries/Theme.php @@ -57,7 +57,23 @@ class Theme_Core { return new View("in_place_edit.html"); } + public function block($type, $module=null) { + $block = ORM::factory("block") + ->where("type", $type); + if (isset($module)) { + $block->where("module", $module); + } + $result = $block->find_all(); + $blocks = ""; + foreach ($result as $block) { + $blocks .= call_user_func($block->method, $this); + } + + return $blocks; + } + public function blocks() { + // @todo make type mandatory, its only optional while i try this out for slideshow /** @todo: make this data driven */ $blocks = array( 'carousel' => carousel::block($this), @@ -65,6 +81,7 @@ class Theme_Core { 'info' => info::block($this), 'gmaps' => gmaps::block($this), ); + kohana::Log("debug", print_r($blocks, true)); return $blocks; } } |