summaryrefslogtreecommitdiff
path: root/app/Report
diff options
context:
space:
mode:
authorGreg Roach <greg@subaqua.co.uk>2021-07-17 09:36:04 +0100
committerGreg Roach <greg@subaqua.co.uk>2021-07-17 11:15:50 +0100
commit97def6bce3212579328010dabdb3cfd539e566f6 (patch)
treedeecf8e5ee8f750214813aa9a1079b99daf1af1d /app/Report
parentc8fd93486d297904a43757cecab7a8694c4f3f21 (diff)
downloadwebtrees-97def6bce3212579328010dabdb3cfd539e566f6.tar.gz
webtrees-97def6bce3212579328010dabdb3cfd539e566f6.tar.bz2
webtrees-97def6bce3212579328010dabdb3cfd539e566f6.zip
Remove class GedcomTag
Diffstat (limited to 'app/Report')
-rw-r--r--app/Report/ReportParserGenerate.php23
1 files changed, 14 insertions, 9 deletions
diff --git a/app/Report/ReportParserGenerate.php b/app/Report/ReportParserGenerate.php
index 74268f5ad6..c90e7ee84e 100644
--- a/app/Report/ReportParserGenerate.php
+++ b/app/Report/ReportParserGenerate.php
@@ -23,11 +23,11 @@ use DomainException;
use Fisharebest\Webtrees\Auth;
use Fisharebest\Webtrees\Carbon;
use Fisharebest\Webtrees\Date;
+use Fisharebest\Webtrees\Elements\UnknownElement;
use Fisharebest\Webtrees\Family;
use Fisharebest\Webtrees\Functions\Functions;
use Fisharebest\Webtrees\Gedcom;
use Fisharebest\Webtrees\GedcomRecord;
-use Fisharebest\Webtrees\GedcomTag;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Individual;
use Fisharebest\Webtrees\Log;
@@ -1242,18 +1242,23 @@ class ReportParserGenerate extends ReportParserBase
$var = $this->vars[$var]['id'];
} else {
$tfact = $this->fact;
- if (($this->fact === 'EVEN' || $this->fact === 'FACT') && $this->type !== ' ') {
+ if (($this->fact === 'EVEN' || $this->fact === 'FACT') && $this->type !== '') {
// Use :
// n TYPE This text if string
$tfact = $this->type;
+ } else {
+ foreach ([Individual::RECORD_TYPE, Family::RECORD_TYPE] as $record_type) {
+ $element = Registry::elementFactory()->make($record_type . ':' . $this->fact);
+
+ if (!$element instanceof UnknownElement) {
+ $tfact = $element->label();
+ break;
+ }
+ }
}
- $var = str_replace([
- '@fact',
- '@desc',
- ], [
- GedcomTag::getLabel($tfact),
- $this->desc,
- ], $var);
+
+ $var = strtr($var, ['@desc' => $this->desc, '@fact' => $tfact]);
+
if (preg_match('/^I18N::number\((.+)\)$/', $var, $match)) {
$var = I18N::number((int) $match[1]);
} elseif (preg_match('/^I18N::translate\(\'(.+)\'\)$/', $var, $match)) {