Lines Matching defs:item
384 * Index tree item formatter for html_buildlist()
390 * @param array $item
394 function html_list_index($item)
397 return (new Index())->formatListItem($item);
401 * Index list item formatter for html_buildlist()
409 * @param array $item
413 function html_li_index($item)
416 return (new Index())->tagListItem($item);
420 * Default list item formatter for html_buildlist()
424 * @param array $item
428 function html_li_default($item)
430 return '<li class="level' . $item['level'] . '">';
437 * Each item in the array has to have a 'level' property
438 * the item itself gets printed by the given $func user
441 * a single item.
448 * @param array $data array with item arrays
450 * @param callable $func callback to print an list item
470 $lifunc = static fn($item) => '<li class="level' . $item['level'] . '">';
473 foreach ($data as $item) {
474 if ($item['level'] > $level) {
476 for ($i = 0; $i < ($item['level'] - $level); $i++) {
481 $level = $item['level'];
482 } elseif ($item['level'] < $level) {
483 //close last item
485 while ($level > $item['level'] && $open > 0) {
492 //close previous item
496 //print item
497 $html .= call_user_func($lifunc, $item);
500 $html .= call_user_func($func, $item);
850 * @param array $item
853 function html_list_toc($item)
855 if (isset($item['hid'])) {
856 $link = '#' . $item['hid'];
858 $link = $item['link'];
861 return '<a href="' . $link . '">' . hsc($item['title']) . '</a>';
873 * @return array the toc item