summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGreg Roach <greg@subaqua.co.uk>2021-02-11 14:32:50 +0000
committerGreg Roach <greg@subaqua.co.uk>2021-02-11 14:35:08 +0000
commit70ac1a220d7b8b1a9f0b161d319970c889724f43 (patch)
tree39ea5d93facd5296fb2b4fed9ce2c0853f2c1121 /app
parent31fd4d4144a406cbee12959609e922a7a960533e (diff)
downloadwebtrees-70ac1a220d7b8b1a9f0b161d319970c889724f43.tar.gz
webtrees-70ac1a220d7b8b1a9f0b161d319970c889724f43.tar.bz2
webtrees-70ac1a220d7b8b1a9f0b161d319970c889724f43.zip
Fix: #3372 - show marriage type as label for fact
Diffstat (limited to 'app')
-rw-r--r--app/Fact.php10
-rw-r--r--app/Functions/FunctionsPrintFacts.php8
2 files changed, 14 insertions, 4 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), '">';