DirectorDatafieldForm: Extend the form with Fields

This commit is contained in:
Alexander Fuhr 2015-07-27 17:25:09 +02:00
parent 1400d3df97
commit a649712048
1 changed files with 19 additions and 0 deletions

View File

@ -32,6 +32,25 @@ class DirectorDatafieldForm extends DirectorObjectForm
'multiOptions' => $this->enumDataTypes(),
'class' => 'autosubmit'
));
// TODO: Form needs to provide a better way for doing this
if (isset($_POST['datatype'])) {
$class = $_POST['datatype'];
if ($class && array_key_exists($class, $this->enumDataTypes())) {
$this->addSettings($class);
}
}
}
protected function addSettings($class = null)
{
if ($class === null) {
if ($class = $this->getValue('datatype')) {
$class::addSettingsFormFields($this);
}
} else {
$class::addSettingsFormFields($this);
}
}
public function onSuccess()