public function __toString()
{
if (!$this->template) {
return '';
}
// $view for use in closure
$view = new View();
$path = Application::getInstance()->getPath();
// setup additional helper path
$view->addHelperPath($path . '/layouts/helpers');
// setup additional partial path
$view->addPartialPath($path . '/layouts/partial');
// setup default path
$view->setPath($path . '/modules/' . $this->module . '/views');
// setup template
$view->setTemplate($this->template);
// setup data
$view->setFromArray($this->getData()->toArray());
return $view->render();
}