Permalink
Browse files

Add support for 'default' context which is merged into more specific …

…contexts.
  • Loading branch information...
1 parent a3c2cdc commit 180211ed4cd487b4c09e801d87658be6fee0df15 @phred committed Apr 7, 2010
Showing with 9 additions and 3 deletions.
  1. +9 −3 classes/controller/twig/template.php
@@ -64,14 +64,20 @@ public function after()
{
// Search for a default context
$config = Kohana::config('context');
-
+
+ $base_dict = (isset($config['default']) ? $config['default'] : array());
+
if (isset($config[$this->request->uri]))
{
- $this->template->set_default($config[$this->request->uri]);
+ $this->template->set_default($config[array_merge($base_dict, $this->request->uri)]);
}
else if (isset($config[$this->template->path()]))
{
- $this->template->set_default($config[$this->template->path()]);
+ $this->template->set_default(array_merge($base_dict, $config[$this->template->path()]));
+ }
+ else
+ {
+ $this->template->set_default($base_dict);
}
// Auto-render the template

0 comments on commit 180211e

Please sign in to comment.