diff --git a/api/etemplate.php b/api/etemplate.php index 2ddc609b52..a6ac8dcc50 100644 --- a/api/etemplate.php +++ b/api/etemplate.php @@ -235,37 +235,46 @@ function send_template() '>'; }, $str); - // handling of partially implemented select widget (no search or tags attribute), incl. removing of type attribute - $str = preg_replace_callback('#<(select)(-[^ ]+)? ([^>]+)/>#', static function (array $matches) { + // handling of partially implemented select and taglist widget, incl. removing of type attribute + $str = preg_replace_callback('#<(select|taglist)(-[^ ]+)? ([^>]+)/>#', static function (array $matches) { preg_match_all('/(^| )([a-z0-9_-]+)="([^"]*)"/i', $matches[3], $attrs, PREG_PATTERN_ORDER); $attrs = array_combine($attrs[2], $attrs[3]); - // add et2-prefix for '; } - return $matches[0]; - }, $str); - /* handling of partially implemented taglist widget (no subtypes and autocomplete_url attribute yet) - $str = preg_replace_callback('#<(taglist)(-[^ ]+)? ([^>]+)/>#', static function (array $matches) { - preg_match_all('/(^| )([a-z0-9_-]+)="([^"]*)"/i', $matches[3], $attrs, PREG_PATTERN_ORDER); - $attrs = array_combine($attrs[2], $attrs[3]); - - // add et2-prefix for vanilla '; + $attrs['multiple'] = 'true'; + unset($attrs['tags']); } - return $matches[0]; - }, $str);*/ + // no multiple="toggle" or expand_multiple_rows="N" currently, thought Shoelace's select multiple="true" is relative close + // until we find something better, just switch to multiple="true" + if (isset($attrs['multiple']) && $attrs['multiple'] === 'toggle' || !empty($attrs['expand_multiple_rows'])) + { + $attrs['multiple'] = 'true'; + unset($attrs['expand_multiple_rows']); + } + // type attribute need to go in widget type