DirectorDataField: Rework the format save process

This commit is contained in:
Alexander Fuhr 2015-07-27 15:52:35 +02:00
parent 03009502a9
commit af874afffd
1 changed files with 6 additions and 5 deletions

View File

@ -32,17 +32,18 @@ class DirectorDatafieldForm extends DirectorObjectForm
'multiOptions' => $this->enumDataTypes(),
'class' => 'autosubmit'
));
}
$this->addElement('hidden', 'format',
array('decorators' => array('ViewHelper'))
);
public function onSuccess()
{
if (isset($_POST['datatype'])) {
$class = $_POST['datatype'];
if ($class && array_key_exists($class, $this->enumDataTypes())) {
$this->getElement('format')->setValue($class::getFormat());
$this->addHidden('format', $class::getFormat());
}
}
parent::onSuccess();
}
protected function enumDataTypes()