Skip to content

Commit

Permalink
Fixing a few issues within the new methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Florian Krämer committed Jul 5, 2012
1 parent ca9ff02 commit b2bb7bf
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/Cake/View/View.php
Expand Up @@ -394,7 +394,7 @@ public function element($name, $data = array(), $options = array()) {
}

if (isset($options['cache'])) {
$contents = $this->_elementCache($name, $plugin, $options);
$contents = $this->_elementCache($name, $plugin, $data, $options);
if ($contents !== false) {
return $contents;
}
Expand Down Expand Up @@ -1107,7 +1107,7 @@ protected function _paths($plugin = null, $cached = true) {
* @param string $plugin Plugin name
* @param array $options Element options
*/
protected function _elementCache($name, $plugin, $options) {
protected function _elementCache($name, $plugin, $data, $options) {
$underscored = null;
if ($plugin) {
$underscored = Inflector::underscore($plugin);
Expand All @@ -1124,8 +1124,8 @@ protected function _elementCache($name, $plugin, $options) {
);
$this->elementCacheSettings = array_merge($defaults, $options['cache']);
}
$key = 'element_' . $this->elementCacheSettings['key'];
return = Cache::read($key, $this->elementCacheSettings['config']);
$this->elementCacheSettings['key'] = 'element_' . $this->elementCacheSettings['key'];
return Cache::read($this->elementCacheSettings['key'], $this->elementCacheSettings['config']);
}

/**
Expand All @@ -1140,7 +1140,7 @@ protected function _renderElement($file, $data, $options) {
if (!$this->_helpersLoaded) {
$this->loadHelpers();
}
if ($callbacks) {
if ($options['callbacks']) {
$this->getEventManager()->dispatch(new CakeEvent('View.beforeRender', $this, array($file)));
}

Expand All @@ -1151,7 +1151,7 @@ protected function _renderElement($file, $data, $options) {
$this->getEventManager()->dispatch(new CakeEvent('View.afterRender', $this, array($file, $element)));
}
if (isset($options['cache'])) {
Cache::write($key, $element, $this->elementCacheSettings['config']);
Cache::write($this->elementCacheSettings['key'], $element, $this->elementCacheSettings['config']);
}
return $element;
}
Expand Down

0 comments on commit b2bb7bf

Please sign in to comment.