"return {$jsFuncName}(event, this);", 'data-name' => $name, // 'data-url' => $props['url'], // TODO: if dynamic content ]), $props['label']), UI::hStyle($cssFile = __FILE__ . ".style.css"), ('static' === $mode) ? UI::h('div', [ 'style' => "display:none" ], [ UI::h('div', [ 'class' => "p5-side_panel p5-side_panel--from-right", 'id' => $idHtmlNode ], [ UI::h('header', [ 'class' => "p5-side_panel__header" ], [ UI::h('h1', [], $props['title']), UI::h('button', [ 'class' => "p5-side_panel__close p5-side_panel--js-close" ], "Close"), ]), UI::h('div', [ 'class' => "p5-side_panel__container" ], [ UI::h('div', [ 'class' => "p5-side_panel__content" ], $childrens), ]), ]), ]) : null // created by JS on demand , ('dynamic' === $mode) ? // TODO: create in JS // like UI_AjaxContent inside `p5-side_panel__content` UI::h('div', [ 'style' => "display:none" ], [ UI::h('div', [ 'class' => "p5-side_panel p5-side_panel--from-right", 'id' => $idHtmlNode ], [ UI::h('header', [ 'class' => "p5-side_panel__header" ], [ UI::h('h1', [], $props['title']), UI::h('button', [ 'class' => "p5-side_panel__close p5-side_panel--js-close" ], "Close"), ]), UI::h('div', [ 'class' => "p5-side_panel__container" ], [ UI::h('div', [ 'class' => "p5-side_panel__content" ], $childrens), ]), ]), ]) : null // created by JS on demand , UI::hScript($jsFile = __FILE__ . '.script.js', $jsonVars = [ // 'FUNCTION_NAME' => $jsFuncName, // 'ID_HTML_NODE' => $idHtmlNode, ]), ]); } static function generateUniqueName() { static $_counter = 0; $_counter += 1; return "p5_side_panel_{$_counter}"; } }