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:
nate 2007-05-23 18:24:22 +00:00
parent 5e6afe29be
commit eaff06bff6

View file

@ -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);