mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-18 11:58:24 +01:00
rename parent_node to parentId, as parentNode is already a DOM property
This commit is contained in:
parent
b9d96ea3e9
commit
39a3ef8183
@ -346,27 +346,28 @@ function send_template()
|
||||
(substr($matches[ADD_ET2_PREFIX_LAST_GROUP], -1) === '/' ? substr($matches[ADD_ET2_PREFIX_LAST_GROUP], 0, -1) .
|
||||
'></et2-' . $matches[3] : $matches[ADD_ET2_PREFIX_LAST_GROUP]) . '>';
|
||||
}, $str);
|
||||
|
||||
// change all attribute-names of new et2-* widgets to camelCase
|
||||
$str = preg_replace_callback('/<et2-([a-z-]+)\s([^>]+)>/', static function(array $matches)
|
||||
{
|
||||
preg_match_all('/(^| )([a-z\d_-]+)="([^"]+)"/i', $matches[2], $attrs, PREG_PATTERN_ORDER);
|
||||
$attrs = array_combine($attrs[2], $attrs[3]);
|
||||
|
||||
foreach($attrs as $name => $value)
|
||||
{
|
||||
if (count($parts = preg_split('/[_-]/', $name)) > 1)
|
||||
{
|
||||
$attrs[array_shift($parts).implode('', array_map('ucfirst', $parts))] = $value;
|
||||
unset($attrs[$name]);
|
||||
}
|
||||
}
|
||||
$ret = str_replace($matches[2], implode(' ', array_map(static function ($name, $value) {
|
||||
return $name . '="' . $value . '"';
|
||||
}, array_keys($attrs), $attrs)).(substr($matches[2], -1) === '/' ? '/' : ''), $matches[0]);
|
||||
return $ret;
|
||||
}, $str);
|
||||
}
|
||||
// change all attribute-names of new et2-* widgets to camelCase
|
||||
$str = preg_replace_callback('/<et2-([a-z-]+)\s([^>]+)>/', static function(array $matches)
|
||||
{
|
||||
preg_match_all('/(^| )([a-z\d_-]+)="([^"]+)"/i', $matches[2], $attrs, PREG_PATTERN_ORDER);
|
||||
$attrs = array_combine($attrs[2], $attrs[3]);
|
||||
|
||||
foreach($attrs as $name => $value)
|
||||
{
|
||||
if (count($parts = preg_split('/[_-]/', $name)) > 1)
|
||||
{
|
||||
if ($name === 'parent_node') $parts[1] = 'Id'; // we can not use DOM property parentNode --> parentId
|
||||
$attrs[array_shift($parts).implode('', array_map('ucfirst', $parts))] = $value;
|
||||
unset($attrs[$name]);
|
||||
}
|
||||
}
|
||||
$ret = str_replace($matches[2], implode(' ', array_map(static function ($name, $value) {
|
||||
return $name . '="' . $value . '"';
|
||||
}, array_keys($attrs), $attrs)).(substr($matches[2], -1) === '/' ? '/' : ''), $matches[0]);
|
||||
return $ret;
|
||||
}, $str);
|
||||
|
||||
$processing = microtime(true);
|
||||
|
||||
if (isset($cache) && (file_exists($cache_dir = dirname($cache)) || mkdir($cache_dir, 0755, true) || is_dir($cache_dir)))
|
||||
|
@ -144,7 +144,7 @@ const Et2WidgetMixin = <T extends Constructor>(superClass : T) =>
|
||||
* Widget ID of another node to insert this node into instead of the normal location
|
||||
* This isn't a normal property...
|
||||
*/
|
||||
parent_node: {type: String},
|
||||
parentId: {type: String},
|
||||
|
||||
/**
|
||||
* Tooltip which is shown for this element on hover
|
||||
@ -901,7 +901,7 @@ const Et2WidgetMixin = <T extends Constructor>(superClass : T) =>
|
||||
*
|
||||
* @param {string} parent
|
||||
*/
|
||||
set parent_node(parent : string | Element)
|
||||
set parentId(parent : string | Element)
|
||||
{
|
||||
if(typeof parent === "string")
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user