mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
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:
parent
087a342886
commit
09e3d91956
@ -759,7 +759,7 @@ class ViewableData extends Object implements IteratorAggregate {
|
|||||||
* @param string|array|SSViewer The template.
|
* @param string|array|SSViewer The template.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function renderWith($template) {
|
function renderWith($template, $params = null) {
|
||||||
if(!is_object($template)) {
|
if(!is_object($template)) {
|
||||||
$template = new SSViewer($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
|
// if the object is already customised (e.g. through Controller->run()), use it
|
||||||
$obj = ($this->customisedObj) ? $this->customisedObj : $this;
|
$obj = ($this->customisedObj) ? $this->customisedObj : $this;
|
||||||
|
|
||||||
|
if($params) $obj = $this->customise($params);
|
||||||
|
|
||||||
if(is_a($template,'SSViewer')) {
|
if(is_a($template,'SSViewer')) {
|
||||||
return $template->process($obj);
|
return $template->process($obj);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user