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 { return $family->children(); })->flatten() ?> 15 <div class="d-flex justify-content-end"> 16 <?php if ($generations > 1 && $grandchildren->isNotEmpty()): ?> 17 <?= view('modules/family-book-chart/children', ['children' => $grandchildren, 'generations' => $generations - 1]) ?> 18 <?php endif ?> 19 <div class="align-self-center"> 20 <?= view('chart-box', ['individual' => $child]) ?> 21 </div> 22 <div class="wt-chart-horizontal-spacer"> 23 <?php if ($children->count() === 1): ?> 24 <div class="wt-chart-horizontal-line"></div> 25 <?php elseif ($n === 0): ?> 26 <div class="wt-chart-horizontal-first-child"></div> 27 <?php elseif ($n + 1 === $children->count()): ?> 28 <div class="wt-chart-horizontal-last-child"></div> 29 <?php else: ?> 30 <div class="wt-chart-horizontal-middle-child"> 31 <div class="wt-chart-horizontal-line"></div> 32 </div> 33 <?php endif ?> 34 </div> 35 </div> 36 <?php endforeach ?> 37</div> 38<?php if ($children->count() > 0): ?> 39 <div class="wt-chart-horizontal-spacer"> 40 <div class="wt-chart-horizontal-line"></div> 41 </div> 42<?php endif ?> 43