app/Functions/FunctionsPrintLists.php
public static function surnameTagCloud(array $surnames, ?ModuleListInterface $module, bool $totals, Tree $tree): string
    {
        $minimum = PHP_INT_MAX;
        $maximum = 1;
        foreach ($surnames as $surn => $surns) {
            foreach ($surns as $spfxsurn => $count) {
                $maximum = max($maximum, $count);
                $minimum = min($minimum, $count);
            }
        }

        $html = '';
        foreach ($surnames as $surn => $surns) {
            foreach ($surns as $spfxsurn => $count) {
                if ($maximum === $minimum) {
                    // All surnames occur the same number of times
                    $size = 150.0;
                } else {
                    $size = 75.0 + 125.0 * ($count - $minimum) / ($maximum - $minimum);
                }
                
                $tag = ($module instanceof ModuleListInterface) ? 'a' : 'span';
                $html .= '<' . $tag . ' style="font-size:' . $size . '%"';
                if ($module instanceof ModuleListInterface) {
                    $url = $module->listUrl($tree, ['surname' => $surn]);
                    $html .= ' href="' . e($url) . '"';
                }
                $html .= '>';
                if ($totals) {
                    $html .= I18N::translate('%1$s (%2$s)', '<span dir="auto">' . $spfxsurn . '</span>', I18N::number($count));
                } else {
                    $html .= $spfxsurn;
                }
                $html .= '</' . $tag . '> ';
            }
        }

        return '<div class="tag_cloud">' . $html . '</div>';
    }
public static function surnameTagCloud(array $surnames, ?ModuleListInterface $module, bool $totals, Tree $tree): string
    {
        $minimum = PHP_INT_MAX;
        $maximum = 1;
        foreach ($surnames as $surn => $surns) {
            foreach ($surns as $spfxsurn => $count) {
                $maximum = max($maximum, $count);
                $minimum = min($minimum, $count);
            }
        }

        $html = '';
        foreach ($surnames as $surn => $surns) {
            foreach ($surns as $spfxsurn => $count) {
                if ($maximum === $minimum) {
                    // All surnames occur the same number of times
                    $size = 150.0;
                } else {
                    $size = 75.0 + 125.0 * ($count - $minimum) / ($maximum - $minimum);
                }
                
                $tag = ($module instanceof ModuleListInterface) ? 'a' : 'span';
                $html .= '<' . $tag . ' style="font-size:' . $size . '%"';
                if ($module instanceof ModuleListInterface) {
                    $url = $module->listUrl($tree, ['surname' => $surn]);
                    $html .= ' href="' . e($url) . '"';
                }
                $html .= '>';
                if ($totals) {
                    $html .= I18N::translate('%1$s (%2$s)', '<span dir="auto">' . $spfxsurn . '</span>', I18N::number($count));
                } else {
                    $html .= $spfxsurn;
                }
                $html .= '</' . $tag . '> ';
            }
        }

        return '<div class="tag_cloud">' . $html . '</div>';
    }
public static function surnameTagCloud ( array $ surnames , ? ModuleListInterface $ module , bool $ totals , Tree $ tree ) : string { $ minimum = PHP_INT_MAX ; $ maximum = 1 ; foreach ( $ surnames as $ surn => $ surns ) { foreach ( $ surns as $ spfxsurn => $ count ) { $ maximum = max ( $ maximum , $ count ) ; $ minimum = min ( $ minimum , $ count ) ; } } $ html = '' ; foreach ( $ surnames as $ surn => $ surns ) { foreach ( $ surns as $ spfxsurn => $ count ) { if ( $ maximum === $ minimum ) { // All surnames occur the same number of times $ size = 150.0 ; } else { $ size = 75.0 + 125.0 * ( $ count - $ minimum ) / ( $ maximum - $ minimum ) ; } $ tag = ( $ module instanceof ModuleListInterface ) ? 'a' : 'span' ; $ html .= '<' . $ tag . ' style="font-size:' . $ size . '%"' ; if ( $ module instanceof ModuleListInterface ) { $ url = $ module -> listUrl ( $ tree , [ 'surname' => $ surn ] ) ; $ html .= ' href="' . e ( $ url ) . '"' ; } $ html .= '>' ; if ( $ totals ) { $ html .= I18N :: translate ( '%1$s (%2$s)' , '<span dir="auto">' . $ spfxsurn . '</span>' , I18N :: number ( $ count ) ) ; } else { $ html .= $ spfxsurn ; } $ html .= '</' . $ tag . '> ' ; } } return '<div class="tag_cloud">' . $ html . '</div>' ; }
Print a tagcloud of surnames.

@param int[][]                  $surnames array (of SURN, of array of SPFX_SURN, of counts)
@param ModuleListInterface|null $module
@param bool                     $totals   show totals after each name
@param Tree                     $tree     generate links to this tree

@return string
Print a tagcloud of surnames .