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
This commit is contained in:
Ingo Schommer 2008-10-05 19:19:07 +00:00
parent 087a342886
commit 09e3d91956

View File

@ -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 {