From 50eabfd29020e7d1f69f4731ada17dcd28b1b95c Mon Sep 17 00:00:00 2001 From: ralf Date: Thu, 21 Jul 2022 12:10:45 +0200 Subject: [PATCH] fix not changed nextmatch-customfilter and listbox (old alias of select) --- api/etemplate.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/api/etemplate.php b/api/etemplate.php index b51ff0dfe9c..f66ddc37685 100644 --- a/api/etemplate.php +++ b/api/etemplate.php @@ -185,7 +185,7 @@ function send_template() // handling of select and taglist widget, incl. removing of type attribute - $str = preg_replace_callback('#<(select|taglist)(-[^ ]+)? ([^>]+?)(/|>(.*?)#s', static function (array $matches) { + $str = preg_replace_callback('#<(select|taglist|listbox)(-[^ ]+)? ([^>]+?)(/|>(.*?)#s', static function (array $matches) { preg_match_all('/(^|\s)([a-z0-9_-]+)="([^"]*)"/i', $matches[3], $attrs, PREG_PATTERN_ORDER); $attrs = array_combine($attrs[2], $attrs[3]); @@ -239,14 +239,18 @@ function send_template() preg_match_all('/(^|\s)([a-z0-9_-]+)="([^"]*)"/i', $matches[4], $attrs, PREG_PATTERN_ORDER); $attrs = array_combine($attrs[2], $attrs[3]); - if(!$matches[2] || in_array($matches[2], ['sort']) || ($matches[2] == "custom" && !$attrs['widget_type'])) + if ($matches[2] === 'custom') + { + $attrs['widget_type'] = $attrs['type']; + } + if(!$matches[2] || in_array($matches[2], ['sort']) || ($matches[2] == "custom" && empty($attrs['widget_type']))) { return $matches[0]; } // No longer needed & type causes problems unset($attrs['type'], $attrs['tags']); - if($matches[2] == 'taglist') + if($matches[2] === 'taglist') { $matches[2] = "filter"; }