1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* webtrees: online genealogy |
5
|
|
|
* Copyright (C) 2025 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
|
|
|
|
18
|
|
|
declare(strict_types=1); |
19
|
|
|
|
20
|
|
|
namespace Fisharebest\Webtrees\Module; |
21
|
|
|
|
22
|
|
|
use Fisharebest\Webtrees\Individual; |
|
|
|
|
23
|
|
|
use Fisharebest\Webtrees\Menu; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Trait ModuleChartTrait - default implementation of ModuleChartInterface |
27
|
|
|
*/ |
28
|
|
|
trait ModuleChartTrait |
29
|
|
|
{ |
30
|
|
|
/** |
31
|
|
|
* A unique internal name for this module (based on the installation folder). |
32
|
|
|
* |
33
|
|
|
* @return string |
34
|
|
|
*/ |
35
|
|
|
abstract public function name(): string; |
36
|
|
|
|
37
|
|
|
abstract public function title(): string; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* A menu item for this chart for an individual box in a chart. |
41
|
|
|
* |
42
|
|
|
* @param Individual $individual |
43
|
|
|
* |
44
|
|
|
* @return Menu|null |
45
|
|
|
*/ |
46
|
|
|
public function chartBoxMenu(Individual $individual): Menu|null |
|
|
|
|
47
|
|
|
{ |
48
|
|
|
return null; |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* A main menu item for this chart. |
53
|
|
|
* |
54
|
|
|
* @param Individual $individual |
55
|
|
|
* |
56
|
|
|
* @return Menu |
57
|
|
|
*/ |
58
|
|
|
public function chartMenu(Individual $individual): Menu |
59
|
|
|
{ |
60
|
|
|
return new Menu( |
61
|
|
|
$this->title(), |
62
|
|
|
$this->chartUrl($individual), |
63
|
|
|
$this->chartMenuClass(), |
64
|
|
|
$this->chartUrlAttributes() |
65
|
|
|
); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* CSS class for the menu. |
70
|
|
|
* |
71
|
|
|
* @return string |
72
|
|
|
*/ |
73
|
|
|
public function chartMenuClass(): string |
74
|
|
|
{ |
75
|
|
|
return ''; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* The title for a specific instance of this chart. |
80
|
|
|
* |
81
|
|
|
* @param Individual $individual |
82
|
|
|
* |
83
|
|
|
* @return string |
84
|
|
|
*/ |
85
|
|
|
public function chartTitle(Individual $individual): string |
|
|
|
|
86
|
|
|
{ |
87
|
|
|
return $this->title(); |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* The URL for a page showing chart options. |
92
|
|
|
* |
93
|
|
|
* @param Individual $individual |
94
|
|
|
* @param array<bool|int|string|array<string>|null> $parameters |
95
|
|
|
* |
96
|
|
|
* @return string |
97
|
|
|
*/ |
98
|
|
|
public function chartUrl(Individual $individual, array $parameters = []): string |
99
|
|
|
{ |
100
|
|
|
return route('module', [ |
101
|
|
|
'module' => $this->name(), |
102
|
|
|
'action' => 'Chart', |
103
|
|
|
'xref' => $individual->xref(), |
104
|
|
|
'tree' => $individual->tree()->name(), |
105
|
|
|
] + $parameters); |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* Attributes for the URL. |
110
|
|
|
* |
111
|
|
|
* @return array<string> |
112
|
|
|
*/ |
113
|
|
|
public function chartUrlAttributes(): array |
114
|
|
|
{ |
115
|
|
|
return ['rel' => 'nofollow']; |
116
|
|
|
} |
117
|
|
|
} |
118
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths