xref: /webtrees/resources/views/fact-parents-age.phtml (revision b11cdcd45131b1585d66693fab363cfeb18c51a4)
1<?php
2
3declare(strict_types=1);
4
5use Fisharebest\Webtrees\Age;
6use Fisharebest\Webtrees\Date;
7use Fisharebest\Webtrees\Family;
8use Fisharebest\Webtrees\Individual;
9
10/**
11 * @var Individual $individual
12 * @var Date       $birth_date
13 */
14
15$family = $individual->childFamilies()->first();
16
17?>
18
19<?php  if ($family instanceof Family && $birth_date->isOK()) : ?>
20    <span class="age">
21    <?php foreach ($family->spouses() as $parent) : ?>
22        <?php if ($parent->getBirthDate()->isOK()) : ?>
23            <?php if ($parent->sex() === 'F') : ?>
24                <?= view('fact-parent-age', ['age' => new Age($parent->getBirthDate(), $birth_date), 'died' => $parent->getDeathDate()->isOK() && $parent->getDeathDate()->maximumJulianDay() < $birth_date->minimumJulianDay() + 90, 'sex' => $parent->sex()]) ?>
25            <?php else : ?>
26                <?= view('fact-parent-age', ['age' => new Age($parent->getBirthDate(), $birth_date), 'died' => $parent->getDeathDate()->isOK() && $parent->getDeathDate()->maximumJulianDay() < $birth_date->minimumJulianDay(), 'sex' => $parent->sex()]) ?>
27            <?php endif ?>
28        <?php endif ?>
29    <?php endforeach ?>
30    </span>
31<?php endif ?>
32