Add factory method to layout class, lets you pass a custom layout into the class
This commit is contained in:
parent
b8c530249f
commit
4748c07be2
|
@ -14,7 +14,7 @@ class Kohana_Kostache {
|
|||
|
||||
protected $_engine;
|
||||
|
||||
public static function factory($cache = FALSE)
|
||||
public static function factory()
|
||||
{
|
||||
$m = new Mustache_Engine(
|
||||
array(
|
||||
|
@ -23,7 +23,7 @@ class Kohana_Kostache {
|
|||
'escape' => function($value) {
|
||||
return html::chars($value);
|
||||
},
|
||||
'cache' => $cache ? APPPATH.'cache/mustache' : NULL,
|
||||
'cache' => APPPATH.'cache/mustache',
|
||||
)
|
||||
);
|
||||
|
||||
|
|
|
@ -20,11 +20,16 @@ class Kohana_Kostache_Layout extends Kohana_Kostache {
|
|||
*/
|
||||
protected $_layout = 'layout';
|
||||
|
||||
public function __construct($engine, $layout = 'layout')
|
||||
public static function factory($layout = 'layout')
|
||||
{
|
||||
$this->_layout = $layout;
|
||||
$k = parent::factory();
|
||||
$k->set_layout($layout);
|
||||
return $k;
|
||||
}
|
||||
|
||||
parent::__construct($engine);
|
||||
public function set_layout($layout)
|
||||
{
|
||||
$this->_layout = (string) $layout;
|
||||
}
|
||||
|
||||
public function render($class, $template = NULL)
|
||||
|
|
Loading…
Reference in a new issue