DirectorDatafieldForm: no more _POST :)

This commit is contained in:
Thomas Gelf 2015-07-28 11:51:17 +02:00
parent d52549acd7
commit 05a63e45d4
1 changed files with 3 additions and 6 deletions

View File

@ -33,9 +33,7 @@ class DirectorDatafieldForm extends DirectorObjectForm
'class' => 'autosubmit' 'class' => 'autosubmit'
)); ));
// TODO: Form needs to provide a better way for doing this if ($class = $this->getSentValue('datatype')) {
if (isset($_POST['datatype'])) {
$class = $_POST['datatype'];
if ($class && array_key_exists($class, $this->enumDataTypes())) { if ($class && array_key_exists($class, $this->enumDataTypes())) {
$this->addSettings($class); $this->addSettings($class);
} }
@ -55,9 +53,8 @@ class DirectorDatafieldForm extends DirectorObjectForm
public function onSuccess() public function onSuccess()
{ {
if (isset($_POST['datatype'])) { if ($class = $this->getValue('datatype')) {
$class = $_POST['datatype']; if (array_key_exists($class, $this->enumDataTypes())) {
if ($class && array_key_exists($class, $this->enumDataTypes())) {
$this->addHidden('format', $class::getFormat()); $this->addHidden('format', $class::getFormat());
} }
} }