mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Adding beforeRender() callback to components
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5159 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
5e6afe29be
commit
eaff06bff6
1 changed files with 10 additions and 0 deletions
|
@ -595,6 +595,16 @@ class Controller extends Object {
|
|||
loadView($this->view);
|
||||
}
|
||||
$this->beforeRender();
|
||||
|
||||
foreach($this->components as $c) {
|
||||
$path = preg_split('/\/|\./', $c);
|
||||
$c = $path[count($path) - 1];
|
||||
if (isset($this->{$c}) && is_object($this->{$c}) && is_callable(array($this->{$c}, 'beforeRender'))) {
|
||||
if (!array_key_exists('enabled', get_object_vars($this->{$c})) || $this->{$c}->enabled == true) {
|
||||
$this->{$c}->beforeRender($this);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->params['models'] = $this->modelNames;
|
||||
|
||||
$this->__viewClass =& new $viewClass($this);
|
||||
|
|
Loading…
Reference in a new issue