/** * Render a partial view. By default, the same script path used by this * view is passed along. This escaper from this view is also passed to * the partial. * * @param string $template * @param array $data * @param string $scriptPath * @return string */ public function partial($template, array $data, $scriptPath = null) { $partial = new View($this->escaper); $partial->assignInstance('headscript', $this->headScript()); $partial->assignInstance('headlink', $this->headLink()); // Pass along any custom helper class assignments to the newly created partial foreach ($this->helperClasses as $name => $className) { $partial->registerHelper($name, $className); } foreach ($this->helpers as $name => $helper) { if ($helper instanceof PageDelegateInterface) { /* @var $partialHelper PageDelegateInterface */ $partialHelper = $partial->helper($name); $partialHelper->setPage($helper->getPage()); } } $partial->setScriptPath($scriptPath ?: $this->scriptPath)->assign($data); return $partial->render($template); }