Skip to content
Browse files

Update the way rendering options are passed between the `Renderer` an…

…d `View` classes
  • Loading branch information...
1 parent 825f427 commit 0d359c825e3aa053c0e25204bc1117ec0efd6957 @mehlah committed Sep 16, 2012
Showing with 11 additions and 4 deletions.
  1. +9 −4 template/view/Renderer.php
  2. +2 −0 template/view/adapter/File.php
View
13 template/view/Renderer.php
@@ -133,6 +133,14 @@
protected $_vars = array();
/**
+ * Available options accepted by `template\View::render()`, used when rendering.
+ *
+ * @see lithium\template\View::render()
+ * @var array
+ */
+ protected $_options = array();
+
+ /**
* Render the template with given data. Abstract; must be added to subclasses.
*
* @param string $template
@@ -486,10 +494,7 @@ public function set(array $data = array()) {
* @return string Returns a the rendered template content as a string.
*/
protected function _render($type, $template, array $data = array(), array $options = array()) {
- if ($this->_request) {
- $library = $this->_request->library;
- $options += compact('library');
- }
+ $options += $this->_options;
return $this->_view->render($type, $data + $this->_data, compact('template') + $options);
}
}
View
2 template/view/adapter/File.php
@@ -102,6 +102,8 @@ public function render($template, $data = array(), array $options = array()) {
$this->_context = $options['context'] + $this->_context;
$this->_data = (array) $data + $this->_vars;
+ $this->_options = $options;
+
$template__ = $template;
unset($options, $template, $defaults, $data);

0 comments on commit 0d359c8

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