summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2019-01-26 17:21:33 +0000
committerGreg Roach <fisharebest@webtrees.net>2019-01-26 17:21:33 +0000
commit2eed66a30cf84ced05bc81c122b483da0073ff02 (patch)
treebcbf4ee499099714d3e04791be7cdab0dba51171
parentf70ab68b72f0a7e3678a4d2b9d89919308945c9f (diff)
downloadwebtrees-2eed66a30cf84ced05bc81c122b483da0073ff02.tar.gz
webtrees-2eed66a30cf84ced05bc81c122b483da0073ff02.tar.bz2
webtrees-2eed66a30cf84ced05bc81c122b483da0073ff02.zip
Do not generate links to relationships chart when it is disabled
-rw-r--r--app/Functions/FunctionsPrintFacts.php31
1 files changed, 17 insertions, 14 deletions
diff --git a/app/Functions/FunctionsPrintFacts.php b/app/Functions/FunctionsPrintFacts.php
index 669ce616aa..7c7400faef 100644
--- a/app/Functions/FunctionsPrintFacts.php
+++ b/app/Functions/FunctionsPrintFacts.php
@@ -32,6 +32,8 @@ use Fisharebest\Webtrees\GedcomTag;
use Fisharebest\Webtrees\I18N;
use Fisharebest\Webtrees\Individual;
use Fisharebest\Webtrees\Media;
+use Fisharebest\Webtrees\Module;
+use Fisharebest\Webtrees\Module\RelationshipsChartModule;
use Fisharebest\Webtrees\Note;
use Fisharebest\Webtrees\Repository;
use Fisharebest\Webtrees\Source;
@@ -528,22 +530,23 @@ class FunctionsPrintFacts
}
$values = ['<a href="' . e($person->url()) . '">' . $person->getFullName() . '</a>'];
- foreach ($associates as $associate) {
- $relationship_name = Functions::getCloseRelationshipName($associate, $person);
- if ($relationship_name === '') {
- $relationship_name = GedcomTag::getLabel('RELA');
- }
- if ($parent instanceof Family) {
- // For family ASSO records (e.g. MARR), identify the spouse with a sex icon
- $relationship_name .= $associate->getSexImage();
- }
+ $module = Module::findByInterface(RelationshipsChartModule::class)->first();
+
+ if ($module instanceof RelationshipsChartModule) {
+ foreach ($associates as $associate) {
+ $relationship_name = Functions::getCloseRelationshipName($associate, $person);
+ if ($relationship_name === '') {
+ $relationship_name = GedcomTag::getLabel('RELA');
+ }
- $values[] = '<a href="' . e(route('relationships', [
- 'xref1' => $associate->xref(),
- 'xref2' => $person->xref(),
- 'ged' => $person->tree()->name(),
- ])) . '" rel="nofollow">' . $relationship_name . '</a>';
+ if ($parent instanceof Family) {
+ // For family ASSO records (e.g. MARR), identify the spouse with a sex icon
+ $relationship_name .= $associate->getSexImage();
+ }
+
+ $values[] = '<a href="' . $module->chartUrl($associate, ['xref2' => $person->xref()]) . '" rel="nofollow">' . $relationship_name . '</a>';
+ }
}
$value = implode(' — ', $values);