| 12345678910111213141516171819202122232425262728293031323334 |
- <?php
- // UI::hAttributes($params);
- // UI::hChildrens($childrens);
- class UI_SidePanelButton implements UITagInterface {
- /**
- * @param string $tagName = 'p5:SidePanelButton'
- * @param array $props
- * @param array $childrens
- *
- * @return string html code
- */
- static function h($tagName, $props = [], $childrens = []) {
- $jsFuncName = "p5_openSideBar"; // TODO: generate name based on $props['name']
- if (empty($props['label'])) throw new Exception("Missing 'label'");
- return UI::h('span', [], [
- UI::h('button', [
- 'onClick' => "return {$jsFuncName}(event, this);",
- 'data-name' => $props['name'],
- // 'data-url' => $props['url'], // TODO: if dynamic content
- ], $props['label']),
- UI::h('div', [ 'style' => "display:none" ], [
- ]),
- UI::hScript($jsFile = __FILE__ . '.script.js', $jsonVars = [
- // 'FUNCTION_NAME' => $jsFuncName,
- ]),
- ]);
- }
- }
|