1<?php 2 3declare(strict_types=1); 4 5use Fisharebest\Webtrees\I18N; 6use Fisharebest\Webtrees\Individual; 7use Fisharebest\Webtrees\Module\IndividualListModule; 8use Fisharebest\Webtrees\Module\ModuleListInterface; 9use Fisharebest\Webtrees\Tree; 10 11/** 12 * @var IndividualListModule|null $module 13 * @var array<string,string> $params 14 * @var array<array<int>> $surnames 15 * @var bool $totals 16 * @var Tree $tree 17 */ 18 19$maximum = max(array_map(static fn (array $x): int => max($x), $surnames)); 20$minimum = min(array_map(static fn (array $x): int => min($x), $surnames)); 21 22?> 23 24<div class="wt-surnames-tag-cloud"> 25 <?php foreach ($surnames as $surn => $surns) : ?> 26 <?php foreach ($surns as $surname => $count) : ?> 27 <?php 28 $size = $maximum === $minimum ? 1.0 : 1.0 + 1.5 * ($count - $minimum) / ($maximum - $minimum); 29 30 if ($surname === Individual::NOMEN_NESCIO) { 31 $label = I18N::translateContext('Unknown surname', '…'); 32 } elseif ($surname === '') { 33 $label = e($surn); 34 } else { 35 $label = e($surname); 36 } 37 38 if ($totals) { 39 $label = I18N::translate('%1$s (%2$s)', $label, I18N::number($count)); 40 } 41 42 ?> 43 <?php if ($module instanceof ModuleListInterface) : ?> 44 <a class="ut" style="font-size:<?= $size ?>rem" href="<?= e($module->listUrl($tree, ['surname' => $surname] + $params)) ?>"> 45 <?= $label ?> 46 </a> 47 <?php else : ?> 48 <span class="text-nowrap ut" style="font-size:<?= $size ?>rem" dir="auto"> 49 <?= $label ?> 50 </span> 51 <?php endif ?> 52 <?php endforeach ?> 53 <?php endforeach ?> 54</div> 55