DirectorObjectForm: add dummy element for db vars

This commit is contained in:
Thomas Gelf 2015-06-15 17:16:43 +02:00
parent 49abd08ec3
commit a9b9342092
1 changed files with 15 additions and 0 deletions

View File

@ -96,12 +96,27 @@ abstract class DirectorObjectForm extends QuickForm
$this->addHidden('id');
}
$this->setDefaults($this->object->getProperties());
if ($this->object->supportsCustomVars()) {
foreach ($this->object->vars() as $key => $value) {
$this->addCustomVar($key, $value);
}
}
if (! $this->hasBeenSubmitted()) {
$this->beforeValidation($this->object->getProperties());
}
return $this;
}
protected function addCustomVar($key, $var)
{
$this->addElement('text', 'var_' . $key, array(
'label' => 'vars.' . $key,
'value' => $var->getValue()
));
}
public function setDb($db)
{
$this->db = $db;