|
@@ -783,4 +783,27 @@ class UI {
|
|
UI::dol(); // UI::dol must include Theme::footer();
|
|
UI::dol(); // UI::dol must include Theme::footer();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static function startDetails($opts, $summaryChildrens) {
|
|
|
|
+ $attrs = array_reduce(array_keys($opts), function ($ret, $optionKey) use ($opts) {
|
|
|
|
+ $option = $opts[$optionKey];
|
|
|
|
+ if (false !== strpos($optionKey, '.')) {
|
|
|
|
+ list($mainKey, $attrName) = explode('.', $optionKey, 2);
|
|
|
|
+ $ret[$mainKey][$attrName] = $option;
|
|
|
|
+ } else {
|
|
|
|
+ $ret['details'][$optionKey] = $option;
|
|
|
|
+ }
|
|
|
|
+ return $ret;
|
|
|
|
+ }, [
|
|
|
|
+ 'details' => [],
|
|
|
|
+ 'summary' => [],
|
|
|
|
+ 'content' => [],
|
|
|
|
+ ]);
|
|
|
|
+ return '<details' . ( empty($attrs['details']) ? '' : ' ' . self::hAttributes($attrs['details']) ) . '>' .
|
|
|
|
+ '<summary' . ( empty($attrs['summary']) ? '' : ' ' . self::hAttributes($attrs['summary']) ) . '>' . self::hChildrens($summaryChildrens) . '</summary>' . "\n" .
|
|
|
|
+ '<div' . ( empty($attrs['content']) ? '' : ' ' . self::hAttributes($attrs['content']) ) . '>' . "\n";
|
|
|
|
+ }
|
|
|
|
+ public static function endDetails() {
|
|
|
|
+ return '</div></details>';
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|