/**
* Returns the rendered view template
*
* @return string
*/
protected function getRenderedTemplate($isRepeatable = false)
{
$sourceTemplate = isset($this->element['source']) ? (string) $this->element['source'] : null;
$sourceView = isset($this->element['source_view']) ? (string) $this->element['source_view'] : null;
$sourceViewType = isset($this->element['source_view_type']) ? (string) $this->element['source_view_type'] : 'html';
$sourceComponent = isset($this->element['source_component']) ? (string) $this->element['source_component'] : null;
if (empty($sourceTemplate)) {
return '';
}
$sourceContainer = empty($sourceComponent) ? $this->form->getContainer() : Container::getInstance($sourceComponent);
if (empty($sourceView)) {
$viewObject = new View($sourceContainer, array('name' => 'FAKE_FORM_VIEW'));
} else {
$viewObject = $sourceContainer->factory->view($sourceView, $sourceViewType);
}
$viewObject->populateFromModel($this->form->getModel());
return $viewObject->loadAnyTemplate($sourceTemplate, array('model' => $isRepeatable ? $this->item : $this->form->getModel(), 'form' => $this->form, 'formType' => $this->form->getAttribute('type', 'edit'), 'fieldValue' => $this->value, 'fieldElement' => $this->element));
}