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. $backends = array();
// this form is only displayed in configuration -> application if preferences backend type of ini is recognized foreach (ResourceFactory::getResourceConfigs()->toArray() as $name => $resource) {
if (isset($formData['global_config_backend']) && $formData['global_config_backend'] === 'ini') { $backends[$name] = $name;
$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
]
);
} }
if (! isset($formData['global_config_backend']) || $formData['global_config_backend'] === 'db') { $this->addElement(
$backends = array(); 'select',
foreach (ResourceFactory::getResourceConfigs()->toArray() as $name => $resource) { 'global_config_resource',
if ($resource['type'] === 'db') { array(
$backends[$name] = $name; 'required' => true,
} 'multiOptions' => array_merge(
} ['' => sprintf(' - %s - ', $this->translate('Please choose'))],
$backends
$this->addElement( ),
'select', 'disable' => [''],
'global_config_resource', 'value' => '',
array( 'label' => $this->translate('Configuration Database')
'required' => true, )
'multiOptions' => array_merge( );
['' => sprintf(' - %s - ', $this->translate('Please choose'))],
$backends
),
'disable' => [''],
'value' => '',
'label' => $this->translate('Configuration Database')
)
);
}
return $this; return $this;
} }