app/Functions/FunctionsPrintLists.php
public static function surnameList($surnames, $style, $totals, ?ModuleListInterface $module, Tree $tree): string
    {
        $html = [];
        foreach ($surnames as $surn => $surns) {
            // Each surname links back to the indilist
            if ($module instanceof ModuleListInterface) {
                if ($surn) {
                    $url = $module->listUrl($tree, ['surname' => $surn]);
                } else {
                    $url = $module->listUrl($tree, ['alpha'  => ',']);
                }
            } else {
                $url = null;
            }

            // If all the surnames are just case variants, then merge them into one
            // Comment out this block if you want SMITH listed separately from Smith
            $tag = ($module instanceof ModuleListInterface) ? 'a' : 'span';
            $subhtml = '<' . $tag;
            if ($url !== null) {
                $subhtml .= ' href="' . e($url) . '"';
            }
            $subhtml .= ' dir="auto">' . e(implode(I18N::$list_separator, array_keys($surns))) . '</' . $tag . '>';
            
            if ($totals) {
                $subtotal = 0;
                foreach ($surns as $count) {
                    $subtotal += $count;
                }
                $subhtml .= '&nbsp;(' . I18N::number($subtotal) . ')';
            }
            $html[] = $subhtml;
        }
        switch ($style) {
            default:
            case 1:
                return '<ul><li>' . implode('</li><li>', $html) . '</li></ul>';
            case 2:
                return implode(I18N::$list_separator, $html);
            case 3:
                $i     = 0;
                $count = count($html);
                if ($count > 36) {
                    $col = 4;
                } elseif ($count > 18) {
                    $col = 3;
                } elseif ($count > 6) {
                    $col = 2;
                } else {
                    $col = 1;
                }
                $newcol = (int) ceil($count / $col);
                $html2  = '<table class="list_table"><tr>';
                $html2 .= '<td class="list_value" style="padding: 14px;">';

                foreach ($html as $surns) {
                    $html2 .= $surns . '<br>';
                    $i++;
                    if ($i === $newcol && $i < $count) {
                        $html2 .= '</td><td class="list_value" style="padding: 14px;">';
                        $newcol = $i + ceil($count / $col);
                    }
                }
                $html2 .= '</td></tr></table>';

                return $html2;
        }
    }
public static function surnameList($surnames, $style, $totals, ?ModuleListInterface $module, Tree $tree): string
    {
        $html = [];
        foreach ($surnames as $surn => $surns) {
            // Each surname links back to the indilist
            if ($module instanceof ModuleListInterface) {
                if ($surn) {
                    $url = $module->listUrl($tree, ['surname' => $surn]);
                } else {
                    $url = $module->listUrl($tree, ['alpha'  => ',']);
                }
            } else {
                $url = null;
            }

            // If all the surnames are just case variants, then merge them into one
            // Comment out this block if you want SMITH listed separately from Smith
            $tag = ($module instanceof ModuleListInterface) ? 'a' : 'span';
            $subhtml = '<' . $tag;
            if ($url !== null) {
                $subhtml .= ' href="' . e($url) . '"';
            }
            $subhtml .= ' dir="auto">' . e(implode(I18N::$list_separator, array_keys($surns))) . '</' . $tag . '>';
            
            if ($totals) {
                $subtotal = 0;
                foreach ($surns as $count) {
                    $subtotal += $count;
                }
                $subhtml .= '&nbsp;(' . I18N::number($subtotal) . ')';
            }
            $html[] = $subhtml;
        }
        switch ($style) {
            default:
            case 1:
                return '<ul><li>' . implode('</li><li>', $html) . '</li></ul>';
            case 2:
                return implode(I18N::$list_separator, $html);
            case 3:
                $i     = 0;
                $count = count($html);
                if ($count > 36) {
                    $col = 4;
                } elseif ($count > 18) {
                    $col = 3;
                } elseif ($count > 6) {
                    $col = 2;
                } else {
                    $col = 1;
                }
                $newcol = (int) ceil($count / $col);
                $html2  = '<table class="list_table"><tr>';
                $html2 .= '<td class="list_value" style="padding: 14px;">';

                foreach ($html as $surns) {
                    $html2 .= $surns . '<br>';
                    $i++;
                    if ($i === $newcol && $i < $count) {
                        $html2 .= '</td><td class="list_value" style="padding: 14px;">';
                        $newcol = $i + ceil($count / $col);
                    }
                }
                $html2 .= '</td></tr></table>';

                return $html2;
        }
    }
public static function surnameList ( $ surnames , $ style , $ totals , ? ModuleListInterface $ module , Tree $ tree ) : string { $ html = [ ] ; foreach ( $ surnames as $ surn => $ surns ) { // Each surname links back to the indilist if ( $ module instanceof ModuleListInterface ) { if ( $ surn ) { $ url = $ module -> listUrl ( $ tree , [ 'surname' => $ surn ] ) ; } else { $ url = $ module -> listUrl ( $ tree , [ 'alpha' => ',' ] ) ; } } else { $ url = null ; } // If all the surnames are just case variants, then merge them into one // Comment out this block if you want SMITH listed separately from Smith $ tag = ( $ module instanceof ModuleListInterface ) ? 'a' : 'span' ; $ subhtml = '<' . $ tag ; if ( $ url !== null ) { $ subhtml .= ' href="' . e ( $ url ) . '"' ; } $ subhtml .= ' dir="auto">' . e ( implode ( I18N :: $ list_separator , array_keys ( $ surns ) ) ) . '</' . $ tag . '>' ; if ( $ totals ) { $ subtotal = 0 ; foreach ( $ surns as $ count ) { $ subtotal += $ count ; } $ subhtml .= '&nbsp;(' . I18N :: number ( $ subtotal ) . ')' ; } $ html [ ] = $ subhtml ; } switch ( $ style ) { default : case 1 : return '<ul><li>' . implode ( '</li><li>' , $ html ) . '</li></ul>' ; case 2 : return implode ( I18N :: $ list_separator , $ html ) ; case 3 : $ i = 0 ; $ count = count ( $ html ) ; if ( $ count > 36 ) { $ col = 4 ; } elseif ( $ count > 18 ) { $ col = 3 ; } elseif ( $ count > 6 ) { $ col = 2 ; } else { $ col = 1 ; } $ newcol = ( int ) ceil ( $ count / $ col ) ; $ html2 = '<table class="list_table"><tr>' ; $ html2 .= '<td class="list_value" style="padding: 14px;">' ; foreach ( $ html as $ surns ) { $ html2 .= $ surns . '<br>' ; $ i ++ ; if ( $ i === $ newcol && $ i < $ count ) { $ html2 .= '</td><td class="list_value" style="padding: 14px;">' ; $ newcol = $ i + ceil ( $ count / $ col ) ; } } $ html2 .= '</td></tr></table>' ; return $ html2 ; } }
Print a list of surnames.

@param int[][]                  $surnames counts of surname by variant
@param int                      $style    1=bullet list, 2=semicolon-separated list, 3=tabulated list with up to 4 columns
@param bool                     $totals   show totals after each name
@param ModuleListInterface|null $module
@param Tree                     $tree     Link back to the individual list in this tree

@return string
Print a list of surnames .