mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-31 01:34:12 +02:00
parent
2ef865392b
commit
d37af09190
@ -11,12 +11,20 @@ class DataTypeDatalist extends DataTypeHook
|
|||||||
{
|
{
|
||||||
public function getFormElement($name, QuickForm $form)
|
public function getFormElement($name, QuickForm $form)
|
||||||
{
|
{
|
||||||
$element = $form->createElement('select', $name, array(
|
$enum = $this->getEntries($form);
|
||||||
'multiOptions' => array(null => '- please choose -') +
|
$params = [];
|
||||||
$this->getEntries($form),
|
if ($this->getSetting('data_type') === 'array') {
|
||||||
));
|
$type = 'extensibleSet';
|
||||||
|
$params['sorted'] = true;
|
||||||
|
$params = ['multiOptions' => $enum];
|
||||||
|
} else {
|
||||||
|
$params = ['multiOptions' => [
|
||||||
|
null => $form->translate('- please choose -'),
|
||||||
|
] + $enum];
|
||||||
|
$type = 'select';
|
||||||
|
}
|
||||||
|
|
||||||
return $element;
|
return $form->createElement($type, $name, $params);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getEntries(QuickForm $form)
|
protected function getEntries(QuickForm $form)
|
||||||
@ -50,6 +58,16 @@ class DataTypeDatalist extends DataTypeHook
|
|||||||
'multiOptions' => array(null => '- please choose -') +
|
'multiOptions' => array(null => '- please choose -') +
|
||||||
$db->enumDatalist(),
|
$db->enumDatalist(),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$form->addElement('select', 'data_type', [
|
||||||
|
'label' => $form->translate('Target data type'),
|
||||||
|
'multiOptions' => $form->optionalEnum([
|
||||||
|
'string' => $form->translate('String'),
|
||||||
|
'array' => $form->translate('Array'),
|
||||||
|
]),
|
||||||
|
'required' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
return $form;
|
return $form;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ class DataTypeDirectorObject extends DataTypeHook
|
|||||||
|
|
||||||
$enum = $db->fetchPairs($query);
|
$enum = $db->fetchPairs($query);
|
||||||
|
|
||||||
|
$params = [];
|
||||||
if ($this->getSetting('data_type') === 'array') {
|
if ($this->getSetting('data_type') === 'array') {
|
||||||
$type = 'extensibleSet';
|
$type = 'extensibleSet';
|
||||||
$params['sorted'] = true;
|
$params['sorted'] = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user