summaryrefslogtreecommitdiff
path: root/app/Http/RequestHandlers/AddChildToFamilyPage.php
diff options
context:
space:
mode:
authorGreg Roach <greg@subaqua.co.uk>2022-02-04 14:08:10 +0000
committerGreg Roach <greg@subaqua.co.uk>2022-02-04 14:10:46 +0000
commit3a1e3ba4136c0d4abee219e17b75c9462a4868a7 (patch)
treea206b564578987b7fed5483c71c56ba505a906f4 /app/Http/RequestHandlers/AddChildToFamilyPage.php
parent10d48f2d26206e97e49ef4b21e5a9c0551cabbd4 (diff)
downloadwebtrees-3a1e3ba4136c0d4abee219e17b75c9462a4868a7.tar.gz
webtrees-3a1e3ba4136c0d4abee219e17b75c9462a4868a7.tar.bz2
webtrees-3a1e3ba4136c0d4abee219e17b75c9462a4868a7.zip
Fix: config for new facts for fam/indi were not being used
Diffstat (limited to 'app/Http/RequestHandlers/AddChildToFamilyPage.php')
-rw-r--r--app/Http/RequestHandlers/AddChildToFamilyPage.php15
1 files changed, 8 insertions, 7 deletions
diff --git a/app/Http/RequestHandlers/AddChildToFamilyPage.php b/app/Http/RequestHandlers/AddChildToFamilyPage.php
index 899c884594..1ff1713149 100644
--- a/app/Http/RequestHandlers/AddChildToFamilyPage.php
+++ b/app/Http/RequestHandlers/AddChildToFamilyPage.php
@@ -74,21 +74,22 @@ class AddChildToFamilyPage implements RequestHandlerInterface
$family = Auth::checkFamilyAccess($family, true);
// Create a dummy individual, so that we can create new/empty facts.
- $element = Registry::elementFactory()->make('INDI:NAME');
- $dummy = Registry::individualFactory()->new('', '0 @@ INDI', null, $tree);
+ $dummy = Registry::individualFactory()->new('', '0 @@ INDI', null, $tree);
- // Default names facts.
+ // Name facts.
$surname_tradition = SurnameTradition::create($tree->getPreference('SURNAME_TRADITION'));
$names = $surname_tradition->newChildNames($family->husband(), $family->wife(), $sex);
- $name_facts = array_map(static fn (string $gedcom): Fact => new Fact($gedcom, $dummy, ''), $names);
+ $name_facts = array_map(static fn(string $gedcom): Fact => new Fact($gedcom, $dummy, ''), $names);
+
+ // Individual facts and events.
+ $quick_facts = explode(',', $tree->getPreference('QUICK_REQUIRED_FACTS'));
+ $indi_facts = array_map(static fn(string $fact): Fact => new Fact('1 ' . $fact, $dummy, ''), $quick_facts);
$facts = [
'i' => [
new Fact('1 SEX ' . $sex, $dummy, ''),
...$name_facts,
- new Fact('1 NAME ' . $element->default($tree), $dummy, ''),
- new Fact('1 BIRT', $dummy, ''),
- new Fact('1 DEAT', $dummy, ''),
+ ...$indi_facts,
],
];