mirror of
https://github.com/alextselegidis/easyappointments.git
synced 2024-11-28 10:53:40 +03:00
Override the "view" method of the CI_Loader class so that layouts are supported
This commit is contained in:
parent
b7c39e94a2
commit
b7bcaa86be
1 changed files with 32 additions and 7 deletions
|
@ -49,6 +49,8 @@ class EA_Loader extends CI_Loader {
|
||||||
* @param bool $return Whether to return the view output or leave it to the Output class
|
* @param bool $return Whether to return the view output or leave it to the Output class
|
||||||
*
|
*
|
||||||
* @return object|string
|
* @return object|string
|
||||||
|
*
|
||||||
|
* remove this
|
||||||
*/
|
*/
|
||||||
public function layout(string $layout, string $page, array $vars = [], bool $return = FALSE)
|
public function layout(string $layout, string $page, array $vars = [], bool $return = FALSE)
|
||||||
{
|
{
|
||||||
|
@ -62,4 +64,27 @@ class EA_Loader extends CI_Loader {
|
||||||
|
|
||||||
return $this->view($layout, $vars, $return);
|
return $this->view($layout, $vars, $return);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override the original view loader method so that layouts are also supported.
|
||||||
|
*
|
||||||
|
* @param string $view View filename.
|
||||||
|
* @param array $vars An associative array of data to be extracted for use in the view.
|
||||||
|
* @param bool $return Whether to return the view output or leave it to the Output class.
|
||||||
|
*
|
||||||
|
* @return object
|
||||||
|
*/
|
||||||
|
public function view($view, $vars = [], $return = FALSE): object
|
||||||
|
{
|
||||||
|
$result = $this->_ci_load(['_ci_view' => $view, '_ci_vars' => $this->_ci_prepare_view_vars($vars), '_ci_return' => $return]);
|
||||||
|
|
||||||
|
$layout = config('layout');
|
||||||
|
|
||||||
|
if ($layout)
|
||||||
|
{
|
||||||
|
$result = $this->_ci_load(['_ci_view' => $layout, '_ci_vars' => $this->_ci_prepare_view_vars($vars), '_ci_return' => $return]);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue