diff options
| -rw-r--r-- | app/Fact.php | 10 | ||||
| -rw-r--r-- | app/Functions/FunctionsPrintFacts.php | 8 | ||||
| -rw-r--r-- | resources/views/modules/relatives/family.phtml | 4 |
3 files changed, 17 insertions, 5 deletions
diff --git a/app/Fact.php b/app/Fact.php index 86925160f9..42d80c44d1 100644 --- a/app/Fact.php +++ b/app/Fact.php @@ -461,6 +461,16 @@ class Fact */ public function label(): string { + // Marriages + if ($this->tag() === 'FAM:MARR') { + $element = Registry::elementFactory()->make('FAM:MARR:TYPE'); + $type = $this->attribute('TYPE'); + + if ($type !== '') { + return $element->value($type, $this->record->tree()); + } + } + // Custom FACT/EVEN - with a TYPE if ($this->tag === 'FACT' || $this->tag === 'EVEN') { $type = $this->attribute('TYPE'); diff --git a/app/Functions/FunctionsPrintFacts.php b/app/Functions/FunctionsPrintFacts.php index 87bc49707a..0195ec4057 100644 --- a/app/Functions/FunctionsPrintFacts.php +++ b/app/Functions/FunctionsPrintFacts.php @@ -162,10 +162,10 @@ class FunctionsPrintFacts $styles[] = 'wt-historic-fact collapse'; } - // Use marriage type as the label. - if ($tag === 'MARR' && $type !== '') { - $label = Registry::elementFactory()->make($fact->tag() . ':TYPE')->value($type, $tree); - $type = ''; // Do not print this again + // Use marriage type as the label. e.g. "Civil partnership" + if ($tag === 'MARR') { + $label = $fact->label(); + $type = ''; } echo '<tr class="', implode(' ', $styles), '">'; diff --git a/resources/views/modules/relatives/family.phtml b/resources/views/modules/relatives/family.phtml index a6727e1606..b85c968101 100644 --- a/resources/views/modules/relatives/family.phtml +++ b/resources/views/modules/relatives/family.phtml @@ -125,7 +125,9 @@ use Fisharebest\Webtrees\Individual; </th> <td> - <?= GedcomTag::getLabelValue($fact->getTag(), $fact->date()->display() . ' — ' . $fact->place()->fullName()) ?> + <span class="label"><?= $fact->label() ?></span> + — + <span class="field"><?= $fact->date()->display() ?> — <?= $fact->place()->fullName() ?></span> </td> </tr> |
