xref: /webtrees/resources/views/modules/family-book-chart/children.phtml (revision bb88f16b1377db732afb12b8b709b3f5f899347a)
1<?php
2
3use Fisharebest\Webtrees\Family;
4use Illuminate\Support\Collection;
5
6/**
7 * @var Collection $children
8 * @var int        $generations
9 */
10
11?>
12<div class="align-self-center">
13    <?php foreach ($children as $n => $child) : ?>
14        <?php $grandchildren = $child->spouseFamilies()->map(static function (Family $family): Collection {
15    return $family->children();
16        })->flatten() ?>
17        <div class="d-flex justify-content-end">
18            <?php if ($generations > 1 && $grandchildren->isNotEmpty()) : ?>
19                <?= view('modules/family-book-chart/children', ['children' => $grandchildren, 'generations' => $generations - 1]) ?>
20            <?php endif ?>
21            <div class="align-self-center">
22                <?= view('chart-box', ['individual' => $child]) ?>
23            </div>
24            <div class="wt-chart-horizontal-spacer">
25                <?php if ($children->count() === 1) : ?>
26                    <div class="wt-chart-horizontal-line"></div>
27                <?php elseif ($n === 0) : ?>
28                    <div class="wt-chart-horizontal-first-child"></div>
29                <?php elseif ($n + 1 === $children->count()) : ?>
30                    <div class="wt-chart-horizontal-last-child"></div>
31                <?php else : ?>
32                    <div class="wt-chart-horizontal-middle-child">
33                        <div class="wt-chart-horizontal-line"></div>
34                    </div>
35                <?php endif ?>
36            </div>
37        </div>
38    <?php endforeach ?>
39</div>
40<?php if ($children->count() > 0) : ?>
41    <div class="wt-chart-horizontal-spacer">
42        <div class="wt-chart-horizontal-line"></div>
43    </div>
44<?php endif ?>
45