mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 12:39:25 +01:00
replace <tree(-cat)? multiple="..." with <et2-tree(-cat)(-multiple) and fix attributes
This commit is contained in:
parent
cf8de8f108
commit
d2e029c504
@ -417,6 +417,21 @@ function send_template()
|
||||
return "<et2-date$matches[1] $matches[2]></et2-date$matches[1]>";
|
||||
}, $str);
|
||||
|
||||
// replace <tree(-cat)? multiple="..." with <et2-tree(-cat)(-multiple) and fix attributes
|
||||
$str = preg_replace_callback('#<tree(-cat)?\s(.*?)\s*/>#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) . "></$tag>";
|
||||
}, $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));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user