Skip to content

Commit 1a83ef4

Browse files
authored
Merge pull request #7663 from kenjis/fix-view-cell-caching
fix: [ViewCells] caching
2 parents e1c3739 + f61b41d commit 1a83ef4

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

system/View/Cell.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ public function __construct(CacheInterface $cache)
6464
/**
6565
* Render a cell, returning its body as a string.
6666
*
67-
* @param array|string|null $params
67+
* @param string $library Cell class and method name.
68+
* @param array|string|null $params Parameters to pass to the method.
69+
* @param int $ttl Number of seconds to cache the cell.
70+
* @param string|null $cacheName Cache item name.
6871
*
6972
* @throws ReflectionException
7073
*/
@@ -76,6 +79,8 @@ public function render(string $library, $params = null, int $ttl = 0, ?string $c
7679
? get_class($instance)
7780
: null;
7881

82+
$params = $this->prepareParams($params);
83+
7984
// Is the output cached?
8085
$cacheName = ! empty($cacheName)
8186
? $cacheName
@@ -93,8 +98,6 @@ public function render(string $library, $params = null, int $ttl = 0, ?string $c
9398
throw ViewException::forInvalidCellMethod($class, $method);
9499
}
95100

96-
$params = $this->prepareParams($params);
97-
98101
$output = $instance instanceof BaseCell
99102
? $this->renderCell($instance, $method, $params)
100103
: $this->renderSimpleClass($instance, $method, $params, $class);

0 commit comments

Comments
 (0)