ApplicationConfigForm: Remove not required Form elements

This commit is contained in:
Sukhwinder Dhillon 2022-05-03 11:30:31 +02:00 committed by Johannes Meyer
parent aad2419545
commit a250202fa3
1 changed files with 17 additions and 49 deletions

View File

@ -70,57 +70,25 @@ class ApplicationConfigForm extends Form
)
);
// we do not need this form for setup because we set the database there as default.
// this form is only displayed in configuration -> application if preferences backend type of ini is recognized
if (isset($formData['global_config_backend']) && $formData['global_config_backend'] === 'ini') {
$this->addElement(
'select',
'global_config_backend',
[
'required' => true,
'autosubmit' => true,
'label' => $this->translate('User Preference Storage Type'),
'multiOptions' => [
'ini' => $this->translate('File System (INI Files)'),
'db' => $this->translate('Database')
]
]
);
} else {
$this->addElement(
'hidden',
'global_config_backend',
[
'required' => true,
'value' => 'db',
'disabled' => true
]
);
$backends = array();
foreach (ResourceFactory::getResourceConfigs()->toArray() as $name => $resource) {
$backends[$name] = $name;
}
if (! isset($formData['global_config_backend']) || $formData['global_config_backend'] === 'db') {
$backends = array();
foreach (ResourceFactory::getResourceConfigs()->toArray() as $name => $resource) {
if ($resource['type'] === 'db') {
$backends[$name] = $name;
}
}
$this->addElement(
'select',
'global_config_resource',
array(
'required' => true,
'multiOptions' => array_merge(
['' => sprintf(' - %s - ', $this->translate('Please choose'))],
$backends
),
'disable' => [''],
'value' => '',
'label' => $this->translate('Configuration Database')
)
);
}
$this->addElement(
'select',
'global_config_resource',
array(
'required' => true,
'multiOptions' => array_merge(
['' => sprintf(' - %s - ', $this->translate('Please choose'))],
$backends
),
'disable' => [''],
'value' => '',
'label' => $this->translate('Configuration Database')
)
);
return $this;
}