only set (default) searchUrl for regular taglist or taglist-email, or if a non-empty autocomplete_url was given

This commit is contained in:
ralf 2022-09-30 15:36:40 +02:00
parent 1d50c1ca91
commit d8e54c72c8

View File

@ -234,11 +234,16 @@ function send_template()
$attrs['editModeEnabled'] = 'true';
}
}
$attrs['searchUrl'] = $attrs['autocomplete_url'] ?? 'EGroupware\\Api\\Etemplate\\Widget\\Taglist::'.
($matches[2] === '-email' ? 'ajax_email' : 'ajax_search');
if (isset($attrs['autocomplete_params']))
// only set (default) searchUrl for regular taglist or taglist-email, or if a non-empty autocomplete_url was given
if (empty($matches['2']) || $matches[2] === '-email' || !empty($attrs['autocomplete_url']))
{
$attrs['searchOptions'] = $attrs['autocomplete_params'];
$attrs['searchUrl'] = $attrs['autocomplete_url'] ?? 'EGroupware\\Api\\Etemplate\\Widget\\Taglist::'.
($matches[2] === '-email' ? 'ajax_email' : 'ajax_search');
if (isset($attrs['autocomplete_params']))
{
$attrs['searchOptions'] = $attrs['autocomplete_params'];
}
}
unset($attrs['autocomplete_url'], $attrs['autocomplete_params']);
if (isset($attrs['maxSelection']) && $attrs['maxSelection'] === '1')