Merge branch 'Daniil/chooserInterface' into 'master'

select + chooser form, main-folder on top of select list

See merge request composer/PHP_Library!6
This commit is contained in:
Федор Подлеснов 2022-01-24 08:55:53 +00:00
commit a8cfe7a685
2 changed files with 12 additions and 1 deletions

View file

@ -93,7 +93,8 @@ class Form_Form extends View_View {
'radio' => 'Form_SelectOne',
'filebrowser' => 'TComponentBrowserInput',
'documents' => 'TComponentBrowserInput',
'chooser' => 'Form_Input'
'chooser' => 'Form_Input',
'select_chooser' => 'Form_SelectOne'
);
}

View file

@ -49,6 +49,16 @@ class Form_OptionFactory {
if (isset($input['default'])) {
array_unshift($field->options, ['value' => 0, 'name' => $input['default']]);
}
// Ставим корневой каталог в начало списка (скорее всего он будет в конце массива)
if ($field->options)
{
$root_elem = array_pop($field->options);
if ($root_elem['value'] == '/')
array_unshift($field->options, $root_elem);
else
array_push($field->options, $root_elem);
}
}
public function optionsDB($key, $val, $res) {