From 09e3d91956c0421747a5f98a2be7c9549a62a2d3 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sun, 5 Oct 2008 19:19:07 +0000 Subject: [PATCH] ENHANCEMENT Added support for customize parameters to ViewableData->renderWith() to avoid unnecessary chaining ($this->customize($params)->renderWith($template)) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@63648 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/ViewableData.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/ViewableData.php b/core/ViewableData.php index 845a9595a..710ccb031 100644 --- a/core/ViewableData.php +++ b/core/ViewableData.php @@ -759,7 +759,7 @@ class ViewableData extends Object implements IteratorAggregate { * @param string|array|SSViewer The template. * @return string */ - function renderWith($template) { + function renderWith($template, $params = null) { if(!is_object($template)) { $template = new SSViewer($template); } @@ -768,6 +768,8 @@ class ViewableData extends Object implements IteratorAggregate { // if the object is already customised (e.g. through Controller->run()), use it $obj = ($this->customisedObj) ? $this->customisedObj : $this; + if($params) $obj = $this->customise($params); + if(is_a($template,'SSViewer')) { return $template->process($obj); } else {