xref: /webtrees/resources/views/lists/surnames-compact-list.phtml (revision d8809d62a7e3fb7260ce3624ee766b7cb2dd1a21)
1<?php
2
3use Fisharebest\Webtrees\I18N;
4use Fisharebest\Webtrees\Module\IndividualListModule;
5use Fisharebest\Webtrees\Module\ModuleListInterface;
6use Fisharebest\Webtrees\Tree;
7
8/**
9 * @var IndividualListModule|null          $module
10 * @var array<string,array<string,string>> $surnames
11 * @var bool                               $totals
12 * @var Tree                               $tree
13 */
14
15$items = [];
16
17foreach ($surnames as $surn => $surns) {
18    foreach ($surns as $spfxsurn => $count) {
19        if ($totals) {
20            $item = I18N::translate('%1$s (%2$s)', '<bdi>' . e($spfxsurn) . '</bdi>', I18N::number($count));
21        } else {
22            $item = '<bdi>' . e($spfxsurn) . '</bdi>';
23        }
24
25        if ($module instanceof ModuleListInterface) {
26            $items[] = '<a class="wt-surnames-compact-list-item" href="' . e($module->listUrl($tree, ['surname' => $surn])) . '">' . $item . '</a>';
27        } else {
28            $items[] = '<span class="wt-surnames-compact-list-item">' . $item . '</span>';
29        }
30    }
31}
32?>
33<span class="wt-surnames-compact-list"><?= implode(I18N::$list_separator, $items) ?></span>
34