Skip to content
This repository
Browse code

Fixing a few issues within the new methods

  • Loading branch information...
commit b2bb7bf2ae32b12f958e556524aa7fee5890723c 1 parent ca9ff02
Florian Krämer authored July 06, 2012

Showing 1 changed file with 6 additions and 6 deletions. Show diff stats Hide diff stats

  1. 12  lib/Cake/View/View.php
12  lib/Cake/View/View.php
@@ -394,7 +394,7 @@ public function element($name, $data = array(), $options = array()) {
394 394
 		}
395 395
 
396 396
 		if (isset($options['cache'])) {
397  
-			$contents = $this->_elementCache($name, $plugin, $options);
  397
+			$contents = $this->_elementCache($name, $plugin, $data, $options);
398 398
 			if ($contents !== false) {
399 399
 				return $contents;
400 400
 			}
@@ -1107,7 +1107,7 @@ protected function _paths($plugin = null, $cached = true) {
1107 1107
  * @param string $plugin Plugin name
1108 1108
  * @param array $options Element options
1109 1109
  */
1110  
-	protected function _elementCache($name, $plugin, $options) {
  1110
+	protected function _elementCache($name, $plugin, $data, $options) {
1111 1111
 		$underscored = null;
1112 1112
 		if ($plugin) {
1113 1113
 			$underscored = Inflector::underscore($plugin);
@@ -1124,8 +1124,8 @@ protected function _elementCache($name, $plugin, $options) {
1124 1124
 			);
1125 1125
 			$this->elementCacheSettings = array_merge($defaults, $options['cache']);
1126 1126
 		}
1127  
-		$key = 'element_' . $this->elementCacheSettings['key'];
1128  
-		return = Cache::read($key, $this->elementCacheSettings['config']);
  1127
+		$this->elementCacheSettings['key'] = 'element_' . $this->elementCacheSettings['key'];
  1128
+		return Cache::read($this->elementCacheSettings['key'], $this->elementCacheSettings['config']);
1129 1129
 	}
1130 1130
 
1131 1131
 /**
@@ -1140,7 +1140,7 @@ protected function _renderElement($file, $data, $options) {
1140 1140
 		if (!$this->_helpersLoaded) {
1141 1141
 			$this->loadHelpers();
1142 1142
 		}
1143  
-		if ($callbacks) {
  1143
+		if ($options['callbacks']) {
1144 1144
 			$this->getEventManager()->dispatch(new CakeEvent('View.beforeRender', $this, array($file)));
1145 1145
 		}
1146 1146
 
@@ -1151,7 +1151,7 @@ protected function _renderElement($file, $data, $options) {
1151 1151
 			$this->getEventManager()->dispatch(new CakeEvent('View.afterRender', $this, array($file, $element)));
1152 1152
 		}
1153 1153
 		if (isset($options['cache'])) {
1154  
-			Cache::write($key, $element, $this->elementCacheSettings['config']);
  1154
+			Cache::write($this->elementCacheSettings['key'], $element, $this->elementCacheSettings['config']);
1155 1155
 		}
1156 1156
 		return $element;
1157 1157
 	}

0 notes on commit b2bb7bf

Please sign in to comment.
Something went wrong with that request. Please try again.