xref: /webtrees/app/Elements/FamilyRecord.php (revision 1270d2767576ed4a83917769b0ee3613e3b010bf)
1<?php
2
3/**
4 * webtrees: online genealogy
5 * Copyright (C) 2023 webtrees development team
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18declare(strict_types=1);
19
20namespace Fisharebest\Webtrees\Elements;
21
22use Fisharebest\Webtrees\Site;
23
24/**
25 * A level 0 family record
26 */
27class FamilyRecord extends AbstractElement
28{
29    protected const SUBTAGS = [
30        'ANUL' => '0:M',
31        'CENS' => '0:M',
32        'CHAN' => '0:1',
33        'CHIL' => '0:M',
34        'DIV'  => '0:M',
35        'DIVF' => '0:M',
36        'ENGA' => '0:M',
37        'EVEN' => '0:M',
38        'HUSB' => '0:1',
39        'MARB' => '0:M',
40        'MARC' => '0:M',
41        'MARL' => '0:M',
42        'MARR' => '0:M',
43        'MARS' => '0:M',
44        'NCHI' => '0:1',
45        'NOTE' => '0:M',
46        'OBJE' => '0:M',
47        'REFN' => '0:M',
48        'RESI' => '0:M',
49        'RESN' => '0:1',
50        'RIN'  => '0:1',
51        'SLGS' => '0:M',
52        'SOUR' => '0:M',
53        'SUBM' => '0:M',
54        'WIFE' => '0:1',
55    ];
56
57    /**
58     * @return array<string,string>
59     */
60    public function subtags(): array
61    {
62        $subtags = parent::subtags();
63
64        if (Site::getPreference('HIDE_FAM_RESI') === '1') {
65            unset($subtags['RESI']);
66        }
67
68        if (Site::getPreference('HIDE_FAM_CENS') === '1') {
69            unset($subtags['CENS']);
70        }
71
72        return $subtags;
73    }
74}
75