Refactoring the view class.
This commit is contained in:
parent
d8d0ddfa09
commit
fa3ec4d796
|
@ -115,10 +115,7 @@ private static function parse($view)
|
||||||
|
|
||||||
$path = ($module == 'application') ? VIEW_PATH : MODULE_PATH.$module.'/views/';
|
$path = ($module == 'application') ? VIEW_PATH : MODULE_PATH.$module.'/views/';
|
||||||
|
|
||||||
if ($module != 'application')
|
if ($module != 'application') $view = substr($view, strpos($view, ':') + 2);
|
||||||
{
|
|
||||||
$view = substr($view, strpos($view, ':') + 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
return array($module, $path, $view);
|
return array($module, $path, $view);
|
||||||
}
|
}
|
||||||
|
@ -162,7 +159,7 @@ private function find_composer_handler($composer)
|
||||||
{
|
{
|
||||||
if (is_callable($value)) return $value;
|
if (is_callable($value)) return $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load the view composers for a given module.
|
* Load the view composers for a given module.
|
||||||
|
@ -193,7 +190,10 @@ public function get()
|
||||||
throw new \Exception("View [$view] does not exist.");
|
throw new \Exception("View [$view] does not exist.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->get_sub_views();
|
foreach ($this->data as &$data)
|
||||||
|
{
|
||||||
|
if ($data instanceof View or $data instanceof Response) $data = (string) $data;
|
||||||
|
}
|
||||||
|
|
||||||
extract($this->data, EXTR_SKIP);
|
extract($this->data, EXTR_SKIP);
|
||||||
|
|
||||||
|
@ -204,22 +204,6 @@ public function get()
|
||||||
return ob_get_clean();
|
return ob_get_clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Evaluate all of the view and response instances that are bound to the view.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
private function get_sub_views()
|
|
||||||
{
|
|
||||||
foreach ($this->data as &$data)
|
|
||||||
{
|
|
||||||
if ($data instanceof View or $data instanceof Response)
|
|
||||||
{
|
|
||||||
$data = (string) $data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a view instance to the view data.
|
* Add a view instance to the view data.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue