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