public function template($scriptPath, $params = [], $resetPassedParams = false, $capture = false)
{
foreach ($params as $key => $value) {
$this->assign($key, $value);
}
if ($capture) {
$captureKey = is_string($capture) ? $capture : 'pimcore_capture_template';
$this->placeholder($captureKey)->captureStart(\Zend_View_Helper_Placeholder_Container_Abstract::SET);
}
$found = false;
$paths = $this->getScriptPaths();
$paths[] = PIMCORE_DOCUMENT_ROOT;
foreach ($paths as $path) {
$p = $path . $scriptPath;
if (is_file($p) && !$found) {
$found = true;
$this->includeTemplateFile($p);
break;
}
}
if (!$found) {
if (is_file($scriptPath)) {
$found = true;
$this->includeTemplateFile($scriptPath);
}
}
if ($resetPassedParams) {
foreach ($params as $key => $value) {
$this->{$key} = null;
}
}
if ($capture) {
$this->placeholder($captureKey)->captureEnd();
return trim($this->placeholder($captureKey)->getValue());
}
}