Better handling for options with more properties set (title, icon)

Previously they were being discarded
This commit is contained in:
nathan 2022-07-14 13:16:48 -06:00
parent 3c96eb9ce6
commit 53e5e45a5d
2 changed files with 5 additions and 4 deletions

View File

@ -194,8 +194,7 @@ export function find_select_options(widget, attr_options?, options : SelectOptio
// @ts-ignore Yes, option.label.label is not supposed to exist but that's what we're checking
if(typeof option.label.label !== "undefined")
{
// @ts-ignore Yes, option.label.label is not supposed to exist but that's what we're checking
option.label = option.label.label;
option = Object.assign(option, option.label);
}
}
fixed_options.push(option);

View File

@ -144,7 +144,7 @@ class Select extends Etemplate\Widget
{
$form_name = self::form_name($cname, $this->id, $expand);
$widget_type = $this->attrs['type'] ? $this->attrs['type'] : $this->type;
$multiple = $this->attrs['multiple'] || $this->getElementAttribute($form_name, 'rows') > 1;
$multiple = $this->attrs['multiple'] || $this->getElementAttribute($form_name, 'multiple') || $this->getElementAttribute($form_name, 'rows') > 1;
$ok = true;
if (!$this->is_readonly($cname, $form_name))
@ -998,4 +998,6 @@ class Select extends Etemplate\Widget
$response->data($options);
}
}
Etemplate\Widget::registerWidget(__NAMESPACE__.'\\Select', array('selectbox', 'listbox', 'select', 'menupopup'));
Etemplate\Widget::registerWidget(__NAMESPACE__ . '\\Select', array('et2-select', 'selectbox', 'listbox', 'select',
'menupopup'));