Add note from #2620

This commit is contained in:
Samuel Georges 2017-01-21 11:30:19 +11:00
parent 1aada3c071
commit 60c322cf46
1 changed files with 4 additions and 3 deletions

View File

@ -971,7 +971,7 @@ class Controller
}
/**
* Renders a component's default content.
* Renders a component's default content, preserves the previous component context.
* @param $name
* @param array $parameters
* @return string Returns the component default contents.
@ -980,17 +980,18 @@ class Controller
{
$result = null;
$previousContext = $this->componentContext;
if ($componentObj = $this->findComponentByName($name)) {
$componentObj->id = uniqid($name);
$componentObj->setProperties(array_merge($componentObj->getProperties(), $parameters));
$this->componentContext = $componentObj;
$result = $componentObj->onRender();
}
if (!$result) {
$result = $this->renderPartial($name.'::default', [], false);
}
$this->componentContext = $previousContext;
return $result;
}