diff --git a/api/etemplate.php b/api/etemplate.php index 63bdbd2b18..d728ae5f90 100644 --- a/api/etemplate.php +++ b/api/etemplate.php @@ -417,6 +417,21 @@ function send_template() return ""; }, $str); + // replace #s', static function (array $matches) + { + $tag = 'et2-tree'.($matches[1] ?? ''); + $attrs = parseAttrs($matches[2]); + if (!empty($attrs['multiple']) && $attrs['multiple'] !== 'false') + { + $tag .= '-multiple'; + } + // fix renamed attrs, thought regular under_score to camelCase happens later + if (!empty($attrs['parent_node'])) $attrs['parentId'] = $attrs['parent_node']; + unset($attrs['multiple'], $attrs['options'], $attrs['parent_node']); + return "<$tag" . stringAttrs($attrs) . ">"; + }, $str); + if ($template === 'mobile') { } @@ -589,4 +604,4 @@ function stringAttrs(array $attrs) return ' '.implode(' ', array_map(static function ($name, $value) { return $name . '="' . $value . '"'; }, array_keys($attrs), $attrs)); -} \ No newline at end of file +}