@@ -34,100 +34,100 @@ |
||
34 | 34 | * Display lineages of people with the same surname. |
35 | 35 | */ |
36 | 36 | class PatronymicLineageModule extends AbstractModule implements |
37 | - ModuleMyArtJaubInterface, |
|
38 | - ModuleListInterface, |
|
39 | - ModuleGlobalInterface |
|
37 | + ModuleMyArtJaubInterface, |
|
38 | + ModuleListInterface, |
|
39 | + ModuleGlobalInterface |
|
40 | 40 | { |
41 | - use ModuleMyArtJaubTrait; |
|
42 | - use ModuleListTrait; |
|
43 | - use ModuleGlobalTrait; |
|
44 | - |
|
45 | - /** |
|
46 | - * {@inheritDoc} |
|
47 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
|
48 | - */ |
|
49 | - public function title(): string |
|
50 | - { |
|
51 | - return /* I18N: Name of the “Patronymic lineage” module */ I18N::translate('Patronymic Lineages'); |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * {@inheritDoc} |
|
56 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::description() |
|
57 | - */ |
|
58 | - public function description(): string |
|
59 | - { |
|
60 | - //phpcs:ignore Generic.Files.LineLength.TooLong |
|
61 | - return /* I18N: Description of the “Patronymic lineage” module */ I18N::translate('Display lineages of people holding the same surname.'); |
|
62 | - } |
|
63 | - |
|
64 | - /** |
|
65 | - * {@inheritDoc} |
|
66 | - * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes() |
|
67 | - */ |
|
68 | - public function loadRoutes(Map $router): void |
|
69 | - { |
|
70 | - $router->attach('', '', static function (Map $router): void { |
|
71 | - |
|
72 | - $router->attach('', '/module-maj/lineages', static function (Map $router): void { |
|
73 | - |
|
74 | - $router->attach('', '/Page', static function (Map $router): void { |
|
75 | - |
|
76 | - $router->get(SurnamesList::class, '/{tree}/list{/alpha}', SurnamesList::class); |
|
77 | - $router->get(LineagesPage::class, '/{tree}/lineage/{surname}', LineagesPage::class); |
|
78 | - }); |
|
79 | - }); |
|
80 | - }); |
|
81 | - } |
|
82 | - |
|
83 | - /** |
|
84 | - * {@inheritDoc} |
|
85 | - * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion() |
|
86 | - */ |
|
87 | - public function customModuleVersion(): string |
|
88 | - { |
|
89 | - return '2.0.11-v.1'; |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * {@inheritDoc} |
|
94 | - * @see \Fisharebest\Webtrees\Module\ModuleListInterface::listUrl() |
|
95 | - */ |
|
96 | - public function listUrl(Tree $tree, array $parameters = []): string |
|
97 | - { |
|
98 | - $surname = $parameters['surname'] ?? ''; |
|
99 | - |
|
100 | - $xref = app(ServerRequestInterface::class)->getAttribute('xref', ''); |
|
101 | - if ($xref !== '' && ($individual = Registry::individualFactory()->make($xref, $tree)) !== null) { |
|
102 | - $surname = $individual->getAllNames()[$individual->getPrimaryName()]['surname']; |
|
103 | - } |
|
104 | - |
|
105 | - if ($surname !== '') { |
|
106 | - return route(LineagesPage::class, [ |
|
107 | - 'tree' => $tree->name(), |
|
108 | - 'surname' => $surname |
|
109 | - ] + $parameters); |
|
110 | - } |
|
111 | - return route(SurnamesList::class, [ |
|
112 | - 'tree' => $tree->name() |
|
113 | - ] + $parameters); |
|
114 | - } |
|
115 | - |
|
116 | - /** |
|
117 | - * {@inheritDoc} |
|
118 | - * @see \Fisharebest\Webtrees\Module\ModuleListInterface::listMenuClass() |
|
119 | - */ |
|
120 | - public function listMenuClass(): string |
|
121 | - { |
|
122 | - return 'menu-maj-patrolineage'; |
|
123 | - } |
|
124 | - |
|
125 | - /** |
|
126 | - * {@inheritDoc} |
|
127 | - * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent() |
|
128 | - */ |
|
129 | - public function headContent(): string |
|
130 | - { |
|
131 | - return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">'; |
|
132 | - } |
|
41 | + use ModuleMyArtJaubTrait; |
|
42 | + use ModuleListTrait; |
|
43 | + use ModuleGlobalTrait; |
|
44 | + |
|
45 | + /** |
|
46 | + * {@inheritDoc} |
|
47 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
|
48 | + */ |
|
49 | + public function title(): string |
|
50 | + { |
|
51 | + return /* I18N: Name of the “Patronymic lineage” module */ I18N::translate('Patronymic Lineages'); |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * {@inheritDoc} |
|
56 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::description() |
|
57 | + */ |
|
58 | + public function description(): string |
|
59 | + { |
|
60 | + //phpcs:ignore Generic.Files.LineLength.TooLong |
|
61 | + return /* I18N: Description of the “Patronymic lineage” module */ I18N::translate('Display lineages of people holding the same surname.'); |
|
62 | + } |
|
63 | + |
|
64 | + /** |
|
65 | + * {@inheritDoc} |
|
66 | + * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes() |
|
67 | + */ |
|
68 | + public function loadRoutes(Map $router): void |
|
69 | + { |
|
70 | + $router->attach('', '', static function (Map $router): void { |
|
71 | + |
|
72 | + $router->attach('', '/module-maj/lineages', static function (Map $router): void { |
|
73 | + |
|
74 | + $router->attach('', '/Page', static function (Map $router): void { |
|
75 | + |
|
76 | + $router->get(SurnamesList::class, '/{tree}/list{/alpha}', SurnamesList::class); |
|
77 | + $router->get(LineagesPage::class, '/{tree}/lineage/{surname}', LineagesPage::class); |
|
78 | + }); |
|
79 | + }); |
|
80 | + }); |
|
81 | + } |
|
82 | + |
|
83 | + /** |
|
84 | + * {@inheritDoc} |
|
85 | + * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion() |
|
86 | + */ |
|
87 | + public function customModuleVersion(): string |
|
88 | + { |
|
89 | + return '2.0.11-v.1'; |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * {@inheritDoc} |
|
94 | + * @see \Fisharebest\Webtrees\Module\ModuleListInterface::listUrl() |
|
95 | + */ |
|
96 | + public function listUrl(Tree $tree, array $parameters = []): string |
|
97 | + { |
|
98 | + $surname = $parameters['surname'] ?? ''; |
|
99 | + |
|
100 | + $xref = app(ServerRequestInterface::class)->getAttribute('xref', ''); |
|
101 | + if ($xref !== '' && ($individual = Registry::individualFactory()->make($xref, $tree)) !== null) { |
|
102 | + $surname = $individual->getAllNames()[$individual->getPrimaryName()]['surname']; |
|
103 | + } |
|
104 | + |
|
105 | + if ($surname !== '') { |
|
106 | + return route(LineagesPage::class, [ |
|
107 | + 'tree' => $tree->name(), |
|
108 | + 'surname' => $surname |
|
109 | + ] + $parameters); |
|
110 | + } |
|
111 | + return route(SurnamesList::class, [ |
|
112 | + 'tree' => $tree->name() |
|
113 | + ] + $parameters); |
|
114 | + } |
|
115 | + |
|
116 | + /** |
|
117 | + * {@inheritDoc} |
|
118 | + * @see \Fisharebest\Webtrees\Module\ModuleListInterface::listMenuClass() |
|
119 | + */ |
|
120 | + public function listMenuClass(): string |
|
121 | + { |
|
122 | + return 'menu-maj-patrolineage'; |
|
123 | + } |
|
124 | + |
|
125 | + /** |
|
126 | + * {@inheritDoc} |
|
127 | + * @see \Fisharebest\Webtrees\Module\ModuleGlobalInterface::headContent() |
|
128 | + */ |
|
129 | + public function headContent(): string |
|
130 | + { |
|
131 | + return '<link rel="stylesheet" href="' . e($this->moduleCssUrl()) . '">'; |
|
132 | + } |
|
133 | 133 | } |