_Form = $form;
}
public function addField() {
$field = new Field($this);
$this->_Fields[] = $field;
return $field;
}
/**
* @param VTEntity $context
*/
public function render(VTEntity $context) {
$this->_HTML = '';
$this->_HTML .= '
';
foreach($this->_Fields as $field) {
if($field->getType() != 'hidden') $this->_HTML .= '
';
$field->render($context);
try {
$this->_HTML .= $field->getHTML();
} catch (\Exception $exp) {}
$this->_JS .= $field->getJS();
if($field->getType() != 'hidden') $this->_HTML .= '
';
}
$this->_HTML .= '
';
}
/**
* @return string
* @throws \Exception
*/
public function getHTML() {
if(empty($this->_HTML)) throw new \Exception('Execute render Function before get HTML');
return $this->_HTML;
}
/**
* @return Field[]
*/
public function getFieldList() {
return $this->_Fields;
}
/**
* @return string
*/
public function getJS() {
return $this->_JS;
}
}