// {$props['summary']}
//
{$props['summary']}
//
// - props[summary] - mixed string|array passed to UI::hChildrens($params)
// - props[type] - string success|info|warning|danger|error
// - props[open] - boolean
// - props[style] - string style attribute value
// - props[summary.style] - string style attribute value
// - props[body.style] - string .p5-details__body style attribute value
class UI_Details implements UITagInterface {
/**
* @param string $tagName = 'p5:Details'
* @param array $props
* @param array $childrens
*
* @return string html code
*/
static function h($tagName, $props = [], $childrens = []) {
if (empty($props['summary'])) throw new Exception("Missing details summary");
$thisProps = [];
$thisProps['style'] = (!empty($props['style'])) ? [ 'style' => $props['style'] ] : [];
return UI::h('details', [
'class' => "p5-details" . (!empty($props['theme']) ? " p5-details--{$props['theme']}" : ""),
'style' => V::get('style', '', $props),
'open' => (true === $props['open']) ? true : false,
'test-attr-true' => true,
'test-attr-false' => false,
], [
UI::h('summary', [
'class' => "p5-details__summary",
'style' => V::get('summary.style', '', $props),
], $props['summary']),
UI::h('div', [
'class' => "p5-details__body",
'style' => V::get('body.style', '', $props),
], $childrens),
]);
}
}