mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 00:34:05 +02:00
DirectorDataField: Rework the format save process
This commit is contained in:
parent
03009502a9
commit
af874afffd
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user