@@ -29,38 +29,38 @@ |
||
29 | 29 | */ |
30 | 30 | class AdminConfigPage implements RequestHandlerInterface |
31 | 31 | { |
32 | - use ViewResponseTrait; |
|
32 | + use ViewResponseTrait; |
|
33 | 33 | |
34 | - private ?HooksModule $module; |
|
35 | - private HookService $hook_service; |
|
34 | + private ?HooksModule $module; |
|
35 | + private HookService $hook_service; |
|
36 | 36 | |
37 | - /** |
|
38 | - * Constructor for AdminConfigPage Request Handler |
|
39 | - * |
|
40 | - * @param ModuleService $module_service |
|
41 | - * @param HookService $hook_service |
|
42 | - */ |
|
43 | - public function __construct(ModuleService $module_service, HookService $hook_service) |
|
44 | - { |
|
45 | - $this->module = $module_service->findByInterface(HooksModule::class)->first(); |
|
46 | - $this->hook_service = $hook_service; |
|
47 | - } |
|
37 | + /** |
|
38 | + * Constructor for AdminConfigPage Request Handler |
|
39 | + * |
|
40 | + * @param ModuleService $module_service |
|
41 | + * @param HookService $hook_service |
|
42 | + */ |
|
43 | + public function __construct(ModuleService $module_service, HookService $hook_service) |
|
44 | + { |
|
45 | + $this->module = $module_service->findByInterface(HooksModule::class)->first(); |
|
46 | + $this->hook_service = $hook_service; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * {@inheritDoc} |
|
51 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
52 | - */ |
|
53 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
54 | - { |
|
55 | - $this->layout = 'layouts/administration'; |
|
49 | + /** |
|
50 | + * {@inheritDoc} |
|
51 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
52 | + */ |
|
53 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
54 | + { |
|
55 | + $this->layout = 'layouts/administration'; |
|
56 | 56 | |
57 | - if ($this->module === null) { |
|
58 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
59 | - } |
|
57 | + if ($this->module === null) { |
|
58 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
59 | + } |
|
60 | 60 | |
61 | - return $this->viewResponse($this->module->name() . '::admin/config', [ |
|
62 | - 'title' => $this->module->title(), |
|
63 | - 'hook_interfaces_list' => $this->hook_service->all(true) |
|
64 | - ]); |
|
65 | - } |
|
61 | + return $this->viewResponse($this->module->name() . '::admin/config', [ |
|
62 | + 'title' => $this->module->title(), |
|
63 | + 'hook_interfaces_list' => $this->hook_service->all(true) |
|
64 | + ]); |
|
65 | + } |
|
66 | 66 | } |
@@ -58,7 +58,7 @@ |
||
58 | 58 | throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
59 | 59 | } |
60 | 60 | |
61 | - return $this->viewResponse($this->module->name() . '::admin/config', [ |
|
61 | + return $this->viewResponse($this->module->name().'::admin/config', [ |
|
62 | 62 | 'title' => $this->module->title(), |
63 | 63 | 'hook_interfaces_list' => $this->hook_service->all(true) |
64 | 64 | ]); |
@@ -24,22 +24,22 @@ |
||
24 | 24 | class Migration1 implements MigrationInterface |
25 | 25 | { |
26 | 26 | |
27 | - /** |
|
28 | - * {@inheritDoc} |
|
29 | - * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade() |
|
30 | - */ |
|
31 | - public function upgrade(): void |
|
32 | - { |
|
33 | - if (DB::schema()->hasTable('maj_hooks')) { |
|
34 | - DB::schema()->drop('maj_hooks'); |
|
35 | - } |
|
36 | - |
|
37 | - DB::schema()->create('maj_hook_order', static function (Blueprint $table): void { |
|
38 | - $table->string('majho_module_name', 32); |
|
39 | - $table->string('majho_hook_name', 64); |
|
40 | - $table->integer('majho_hook_order')->nullable(); |
|
41 | - |
|
42 | - $table->primary(['majho_module_name', 'majho_hook_name']); |
|
43 | - }); |
|
44 | - } |
|
27 | + /** |
|
28 | + * {@inheritDoc} |
|
29 | + * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade() |
|
30 | + */ |
|
31 | + public function upgrade(): void |
|
32 | + { |
|
33 | + if (DB::schema()->hasTable('maj_hooks')) { |
|
34 | + DB::schema()->drop('maj_hooks'); |
|
35 | + } |
|
36 | + |
|
37 | + DB::schema()->create('maj_hook_order', static function (Blueprint $table): void { |
|
38 | + $table->string('majho_module_name', 32); |
|
39 | + $table->string('majho_hook_name', 64); |
|
40 | + $table->integer('majho_hook_order')->nullable(); |
|
41 | + |
|
42 | + $table->primary(['majho_module_name', 'majho_hook_name']); |
|
43 | + }); |
|
44 | + } |
|
45 | 45 | } |
@@ -34,7 +34,7 @@ |
||
34 | 34 | DB::schema()->drop('maj_hooks'); |
35 | 35 | } |
36 | 36 | |
37 | - DB::schema()->create('maj_hook_order', static function (Blueprint $table): void { |
|
37 | + DB::schema()->create('maj_hook_order', static function(Blueprint $table): void { |
|
38 | 38 | $table->string('majho_module_name', 32); |
39 | 39 | $table->string('majho_hook_name', 64); |
40 | 40 | $table->integer('majho_hook_order')->nullable(); |
@@ -22,13 +22,13 @@ |
||
22 | 22 | class Migration0 implements MigrationInterface |
23 | 23 | { |
24 | 24 | |
25 | - /** |
|
26 | - * {@inheritDoc} |
|
27 | - * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade() |
|
28 | - */ |
|
29 | - public function upgrade(): void |
|
30 | - { |
|
25 | + /** |
|
26 | + * {@inheritDoc} |
|
27 | + * @see \Fisharebest\Webtrees\Schema\MigrationInterface::upgrade() |
|
28 | + */ |
|
29 | + public function upgrade(): void |
|
30 | + { |
|
31 | 31 | |
32 | - // This migration has been superseded by migration 1. |
|
33 | - } |
|
32 | + // This migration has been superseded by migration 1. |
|
33 | + } |
|
34 | 34 | } |
@@ -30,104 +30,104 @@ |
||
30 | 30 | */ |
31 | 31 | class HookService implements HookServiceInterface |
32 | 32 | { |
33 | - private ModuleService $module_service; |
|
33 | + private ModuleService $module_service; |
|
34 | 34 | |
35 | - /** |
|
36 | - * Constructor for HookService |
|
37 | - * |
|
38 | - * @param ModuleService $module_service |
|
39 | - */ |
|
40 | - public function __construct(ModuleService $module_service) |
|
41 | - { |
|
42 | - $this->module_service = $module_service; |
|
43 | - } |
|
35 | + /** |
|
36 | + * Constructor for HookService |
|
37 | + * |
|
38 | + * @param ModuleService $module_service |
|
39 | + */ |
|
40 | + public function __construct(ModuleService $module_service) |
|
41 | + { |
|
42 | + $this->module_service = $module_service; |
|
43 | + } |
|
44 | 44 | |
45 | - /** |
|
46 | - * {@inheritDoc} |
|
47 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookServiceInterface::use() |
|
48 | - */ |
|
49 | - public function use(string $hook_interface): ?HookCollectorInterface |
|
50 | - { |
|
51 | - return $this->all()->get($hook_interface); |
|
52 | - } |
|
45 | + /** |
|
46 | + * {@inheritDoc} |
|
47 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookServiceInterface::use() |
|
48 | + */ |
|
49 | + public function use(string $hook_interface): ?HookCollectorInterface |
|
50 | + { |
|
51 | + return $this->all()->get($hook_interface); |
|
52 | + } |
|
53 | 53 | |
54 | 54 | |
55 | - /** |
|
56 | - * Find a hook collector by its name, with or without the disabled ones. |
|
57 | - * |
|
58 | - * @template THook of HookInterface |
|
59 | - * @param string $hook_name |
|
60 | - * @return HookCollectorInterface<THook>|null |
|
61 | - */ |
|
62 | - public function find(string $hook_name, bool $include_disabled = false): ?HookCollectorInterface |
|
63 | - { |
|
64 | - return $this->all($include_disabled) |
|
65 | - ->first(fn(HookCollectorInterface $hook_collector) => $hook_collector->name() === $hook_name); |
|
66 | - } |
|
55 | + /** |
|
56 | + * Find a hook collector by its name, with or without the disabled ones. |
|
57 | + * |
|
58 | + * @template THook of HookInterface |
|
59 | + * @param string $hook_name |
|
60 | + * @return HookCollectorInterface<THook>|null |
|
61 | + */ |
|
62 | + public function find(string $hook_name, bool $include_disabled = false): ?HookCollectorInterface |
|
63 | + { |
|
64 | + return $this->all($include_disabled) |
|
65 | + ->first(fn(HookCollectorInterface $hook_collector) => $hook_collector->name() === $hook_name); |
|
66 | + } |
|
67 | 67 | |
68 | - /** |
|
69 | - * Get all hook collectors subscribed by modules, with hooks ordered, with or without the disabled ones. |
|
70 | - * |
|
71 | - * @template THook of HookInterface |
|
72 | - * @param bool $include_disabled |
|
73 | - * @return Collection<string, HookCollectorInterface<THook>> |
|
74 | - */ |
|
75 | - public function all(bool $include_disabled = false): Collection |
|
76 | - { |
|
77 | - return Registry::cache()->array()->remember('all-hooks', function () use ($include_disabled): Collection { |
|
78 | - $hooks_info = DB::table('maj_hook_order') |
|
79 | - ->get() |
|
80 | - ->groupBy(['majho_hook_name', 'majho_module_name']); |
|
68 | + /** |
|
69 | + * Get all hook collectors subscribed by modules, with hooks ordered, with or without the disabled ones. |
|
70 | + * |
|
71 | + * @template THook of HookInterface |
|
72 | + * @param bool $include_disabled |
|
73 | + * @return Collection<string, HookCollectorInterface<THook>> |
|
74 | + */ |
|
75 | + public function all(bool $include_disabled = false): Collection |
|
76 | + { |
|
77 | + return Registry::cache()->array()->remember('all-hooks', function () use ($include_disabled): Collection { |
|
78 | + $hooks_info = DB::table('maj_hook_order') |
|
79 | + ->get() |
|
80 | + ->groupBy(['majho_hook_name', 'majho_module_name']); |
|
81 | 81 | |
82 | - $hooks = $this->module_service |
|
83 | - ->findByInterface(ModuleHookSubscriberInterface::class, $include_disabled) |
|
84 | - ->flatMap(fn(ModuleHookSubscriberInterface $module) => $module->listSubscribedHooks()); |
|
82 | + $hooks = $this->module_service |
|
83 | + ->findByInterface(ModuleHookSubscriberInterface::class, $include_disabled) |
|
84 | + ->flatMap(fn(ModuleHookSubscriberInterface $module) => $module->listSubscribedHooks()); |
|
85 | 85 | |
86 | - $hook_collectors = collect(); |
|
87 | - $hook_instances = collect(); |
|
88 | - foreach ($hooks as $hook) { |
|
89 | - if (!($hook instanceof HookInterface)) { |
|
90 | - continue; |
|
91 | - } |
|
92 | - if ($hook instanceof HookCollectorInterface) { |
|
93 | - $hook_collectors->put($hook->hookInterface(), $hook); |
|
94 | - } else { |
|
95 | - $hook_instances->add($hook); |
|
96 | - } |
|
97 | - } |
|
86 | + $hook_collectors = collect(); |
|
87 | + $hook_instances = collect(); |
|
88 | + foreach ($hooks as $hook) { |
|
89 | + if (!($hook instanceof HookInterface)) { |
|
90 | + continue; |
|
91 | + } |
|
92 | + if ($hook instanceof HookCollectorInterface) { |
|
93 | + $hook_collectors->put($hook->hookInterface(), $hook); |
|
94 | + } else { |
|
95 | + $hook_instances->add($hook); |
|
96 | + } |
|
97 | + } |
|
98 | 98 | |
99 | - foreach ($hook_collectors as $hook_interface => $hook_collector) { |
|
100 | - $hook_info = $hooks_info->get($hook_collector->name()) ?? collect(); |
|
101 | - foreach ( |
|
102 | - $hook_instances->filter( |
|
103 | - fn(HookInterface $hook): bool => $hook instanceof $hook_interface |
|
104 | - ) as $hook_instance |
|
105 | - ) { |
|
106 | - $hook_module_info = $hook_info->get($hook_instance->module()->name(), collect())->first(); |
|
107 | - $hook_order = $hook_module_info instanceof stdClass ? (int) $hook_module_info->majho_hook_order : 0; |
|
108 | - $hook_collector->register($hook_instance, $hook_order); |
|
109 | - } |
|
110 | - } |
|
111 | - return $hook_collectors; |
|
112 | - }); |
|
113 | - } |
|
99 | + foreach ($hook_collectors as $hook_interface => $hook_collector) { |
|
100 | + $hook_info = $hooks_info->get($hook_collector->name()) ?? collect(); |
|
101 | + foreach ( |
|
102 | + $hook_instances->filter( |
|
103 | + fn(HookInterface $hook): bool => $hook instanceof $hook_interface |
|
104 | + ) as $hook_instance |
|
105 | + ) { |
|
106 | + $hook_module_info = $hook_info->get($hook_instance->module()->name(), collect())->first(); |
|
107 | + $hook_order = $hook_module_info instanceof stdClass ? (int) $hook_module_info->majho_hook_order : 0; |
|
108 | + $hook_collector->register($hook_instance, $hook_order); |
|
109 | + } |
|
110 | + } |
|
111 | + return $hook_collectors; |
|
112 | + }); |
|
113 | + } |
|
114 | 114 | |
115 | - /** |
|
116 | - * Update the order of the modules implementing a hook in the database. |
|
117 | - * |
|
118 | - * @template THook of HookInterface |
|
119 | - * @param HookCollectorInterface<THook> $hook_collector |
|
120 | - * @param ModuleInterface $module |
|
121 | - * @param int $order |
|
122 | - * @return int |
|
123 | - */ |
|
124 | - public function updateOrder(HookCollectorInterface $hook_collector, ModuleInterface $module, int $order): int |
|
125 | - { |
|
126 | - return DB::table('maj_hook_order') |
|
127 | - ->upsert([ |
|
128 | - 'majho_module_name' => $module->name(), |
|
129 | - 'majho_hook_name' => $hook_collector->name(), |
|
130 | - 'majho_hook_order' => $order |
|
131 | - ], ['majho_module_name', 'majho_hook_name'], ['majho_hook_order']); |
|
132 | - } |
|
115 | + /** |
|
116 | + * Update the order of the modules implementing a hook in the database. |
|
117 | + * |
|
118 | + * @template THook of HookInterface |
|
119 | + * @param HookCollectorInterface<THook> $hook_collector |
|
120 | + * @param ModuleInterface $module |
|
121 | + * @param int $order |
|
122 | + * @return int |
|
123 | + */ |
|
124 | + public function updateOrder(HookCollectorInterface $hook_collector, ModuleInterface $module, int $order): int |
|
125 | + { |
|
126 | + return DB::table('maj_hook_order') |
|
127 | + ->upsert([ |
|
128 | + 'majho_module_name' => $module->name(), |
|
129 | + 'majho_hook_name' => $hook_collector->name(), |
|
130 | + 'majho_hook_order' => $order |
|
131 | + ], ['majho_module_name', 'majho_hook_name'], ['majho_hook_order']); |
|
132 | + } |
|
133 | 133 | } |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function all(bool $include_disabled = false): Collection |
76 | 76 | { |
77 | - return Registry::cache()->array()->remember('all-hooks', function () use ($include_disabled): Collection { |
|
77 | + return Registry::cache()->array()->remember('all-hooks', function() use ($include_disabled): Collection { |
|
78 | 78 | $hooks_info = DB::table('maj_hook_order') |
79 | 79 | ->get() |
80 | 80 | ->groupBy(['majho_hook_name', 'majho_module_name']); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | ) as $hook_instance |
105 | 105 | ) { |
106 | 106 | $hook_module_info = $hook_info->get($hook_instance->module()->name(), collect())->first(); |
107 | - $hook_order = $hook_module_info instanceof stdClass ? (int) $hook_module_info->majho_hook_order : 0; |
|
107 | + $hook_order = $hook_module_info instanceof stdClass ? (int)$hook_module_info->majho_hook_order : 0; |
|
108 | 108 | $hook_collector->register($hook_instance, $hook_order); |
109 | 109 | } |
110 | 110 | } |
@@ -25,68 +25,68 @@ |
||
25 | 25 | */ |
26 | 26 | class TitlesCardHook implements NameAccordionExtenderInterface |
27 | 27 | { |
28 | - private ModuleInterface $module; |
|
28 | + private ModuleInterface $module; |
|
29 | 29 | |
30 | - /** |
|
31 | - * Constructor for TitlesCardHook |
|
32 | - * |
|
33 | - * @param ModuleInterface $module |
|
34 | - */ |
|
35 | - public function __construct(ModuleInterface $module) |
|
36 | - { |
|
37 | - $this->module = $module; |
|
38 | - } |
|
30 | + /** |
|
31 | + * Constructor for TitlesCardHook |
|
32 | + * |
|
33 | + * @param ModuleInterface $module |
|
34 | + */ |
|
35 | + public function __construct(ModuleInterface $module) |
|
36 | + { |
|
37 | + $this->module = $module; |
|
38 | + } |
|
39 | 39 | |
40 | - /** |
|
41 | - * {@inheritDoc} |
|
42 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookInterface::module() |
|
43 | - */ |
|
44 | - public function module(): ModuleInterface |
|
45 | - { |
|
46 | - return $this->module; |
|
47 | - } |
|
40 | + /** |
|
41 | + * {@inheritDoc} |
|
42 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\HookInterface::module() |
|
43 | + */ |
|
44 | + public function module(): ModuleInterface |
|
45 | + { |
|
46 | + return $this->module; |
|
47 | + } |
|
48 | 48 | |
49 | - /** |
|
50 | - * {@inheritDoc} |
|
51 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\NameAccordionExtenderInterface::accordionCard() |
|
52 | - */ |
|
53 | - public function accordionCard(Individual $individual): string |
|
54 | - { |
|
55 | - $title_separator = $this->module->getPreference('MAJ_TITLE_PREFIX'); |
|
56 | - if ($title_separator === '') { |
|
57 | - return ''; |
|
58 | - } |
|
49 | + /** |
|
50 | + * {@inheritDoc} |
|
51 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\NameAccordionExtenderInterface::accordionCard() |
|
52 | + */ |
|
53 | + public function accordionCard(Individual $individual): string |
|
54 | + { |
|
55 | + $title_separator = $this->module->getPreference('MAJ_TITLE_PREFIX'); |
|
56 | + if ($title_separator === '') { |
|
57 | + return ''; |
|
58 | + } |
|
59 | 59 | |
60 | - $titles = $this->individualTitles($individual, '/(.*?) ((' . $title_separator . ')(.*))/i'); |
|
60 | + $titles = $this->individualTitles($individual, '/(.*?) ((' . $title_separator . ')(.*))/i'); |
|
61 | 61 | |
62 | - return count($titles) === 0 ? '' : |
|
63 | - view($this->module()->name() . '::components/card-titles', [ 'titles' => $titles ]); |
|
64 | - } |
|
62 | + return count($titles) === 0 ? '' : |
|
63 | + view($this->module()->name() . '::components/card-titles', [ 'titles' => $titles ]); |
|
64 | + } |
|
65 | 65 | |
66 | - /** |
|
67 | - * Extract the individual titles from the TITL tags. |
|
68 | - * Split the title based on a pattern to identify the title and the land it refers to. |
|
69 | - * |
|
70 | - * @param Individual $individual |
|
71 | - * @param string $pattern |
|
72 | - * @return array<string, string[]> |
|
73 | - */ |
|
74 | - protected function individualTitles(Individual $individual, string $pattern): array |
|
75 | - { |
|
76 | - $titles_list = []; |
|
77 | - /** @var \Illuminate\Support\Collection<string> $titles */ |
|
78 | - $titles = $individual->facts(['TITL']) |
|
79 | - ->sortByDesc(fn(Fact $fact) => $fact->date()->julianDay()) |
|
80 | - ->map(fn(Fact $fact) => $fact->value()); |
|
66 | + /** |
|
67 | + * Extract the individual titles from the TITL tags. |
|
68 | + * Split the title based on a pattern to identify the title and the land it refers to. |
|
69 | + * |
|
70 | + * @param Individual $individual |
|
71 | + * @param string $pattern |
|
72 | + * @return array<string, string[]> |
|
73 | + */ |
|
74 | + protected function individualTitles(Individual $individual, string $pattern): array |
|
75 | + { |
|
76 | + $titles_list = []; |
|
77 | + /** @var \Illuminate\Support\Collection<string> $titles */ |
|
78 | + $titles = $individual->facts(['TITL']) |
|
79 | + ->sortByDesc(fn(Fact $fact) => $fact->date()->julianDay()) |
|
80 | + ->map(fn(Fact $fact) => $fact->value()); |
|
81 | 81 | |
82 | - foreach ($titles as $title) { |
|
83 | - if (preg_match($pattern, $title, $match) === 1) { |
|
84 | - /** @var array<int, string> $match */ |
|
85 | - $titles_list[$match[1]][] = trim($match[2]); |
|
86 | - } else { |
|
87 | - $titles_list[$title][] = ''; |
|
88 | - } |
|
89 | - } |
|
90 | - return $titles_list; |
|
91 | - } |
|
82 | + foreach ($titles as $title) { |
|
83 | + if (preg_match($pattern, $title, $match) === 1) { |
|
84 | + /** @var array<int, string> $match */ |
|
85 | + $titles_list[$match[1]][] = trim($match[2]); |
|
86 | + } else { |
|
87 | + $titles_list[$title][] = ''; |
|
88 | + } |
|
89 | + } |
|
90 | + return $titles_list; |
|
91 | + } |
|
92 | 92 | } |
@@ -57,10 +57,9 @@ |
||
57 | 57 | return ''; |
58 | 58 | } |
59 | 59 | |
60 | - $titles = $this->individualTitles($individual, '/(.*?) ((' . $title_separator . ')(.*))/i'); |
|
60 | + $titles = $this->individualTitles($individual, '/(.*?) (('.$title_separator.')(.*))/i'); |
|
61 | 61 | |
62 | - return count($titles) === 0 ? '' : |
|
63 | - view($this->module()->name() . '::components/card-titles', [ 'titles' => $titles ]); |
|
62 | + return count($titles) === 0 ? '' : view($this->module()->name().'::components/card-titles', ['titles' => $titles]); |
|
64 | 63 | } |
65 | 64 | |
66 | 65 | /** |
@@ -27,43 +27,43 @@ |
||
27 | 27 | */ |
28 | 28 | class AdminConfigAction implements RequestHandlerInterface |
29 | 29 | { |
30 | - private ?MiscExtensionsModule $module; |
|
30 | + private ?MiscExtensionsModule $module; |
|
31 | 31 | |
32 | - /** |
|
33 | - * Constructor for AdminConfigPage Request Handler |
|
34 | - * |
|
35 | - * @param ModuleService $module_service |
|
36 | - */ |
|
37 | - public function __construct(ModuleService $module_service) |
|
38 | - { |
|
39 | - $this->module = $module_service->findByInterface(MiscExtensionsModule::class)->first(); |
|
40 | - } |
|
32 | + /** |
|
33 | + * Constructor for AdminConfigPage Request Handler |
|
34 | + * |
|
35 | + * @param ModuleService $module_service |
|
36 | + */ |
|
37 | + public function __construct(ModuleService $module_service) |
|
38 | + { |
|
39 | + $this->module = $module_service->findByInterface(MiscExtensionsModule::class)->first(); |
|
40 | + } |
|
41 | 41 | |
42 | - /** |
|
43 | - * {@inheritDoc} |
|
44 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
45 | - */ |
|
46 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
47 | - { |
|
48 | - if ($this->module === null) { |
|
49 | - FlashMessages::addMessage( |
|
50 | - I18N::translate('The attached module could not be found.'), |
|
51 | - 'danger' |
|
52 | - ); |
|
53 | - return redirect(route(AdminConfigPage::class)); |
|
54 | - } |
|
42 | + /** |
|
43 | + * {@inheritDoc} |
|
44 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
45 | + */ |
|
46 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
47 | + { |
|
48 | + if ($this->module === null) { |
|
49 | + FlashMessages::addMessage( |
|
50 | + I18N::translate('The attached module could not be found.'), |
|
51 | + 'danger' |
|
52 | + ); |
|
53 | + return redirect(route(AdminConfigPage::class)); |
|
54 | + } |
|
55 | 55 | |
56 | - $params = (array) $request->getParsedBody(); |
|
56 | + $params = (array) $request->getParsedBody(); |
|
57 | 57 | |
58 | - $this->module->setPreference('MAJ_TITLE_PREFIX', $params['MAJ_TITLE_PREFIX'] ?? ''); |
|
59 | - $this->module->setPreference('MAJ_DISPLAY_CNIL', $params['MAJ_DISPLAY_CNIL'] ?? ''); |
|
60 | - $this->module->setPreference('MAJ_CNIL_REFERENCE', $params['MAJ_CNIL_REFERENCE' ?? '']); |
|
58 | + $this->module->setPreference('MAJ_TITLE_PREFIX', $params['MAJ_TITLE_PREFIX'] ?? ''); |
|
59 | + $this->module->setPreference('MAJ_DISPLAY_CNIL', $params['MAJ_DISPLAY_CNIL'] ?? ''); |
|
60 | + $this->module->setPreference('MAJ_CNIL_REFERENCE', $params['MAJ_CNIL_REFERENCE' ?? '']); |
|
61 | 61 | |
62 | - FlashMessages::addMessage( |
|
63 | - I18N::translate('The preferences for the module “%s” have been updated.', $this->module->title()), |
|
64 | - 'success' |
|
65 | - ); |
|
62 | + FlashMessages::addMessage( |
|
63 | + I18N::translate('The preferences for the module “%s” have been updated.', $this->module->title()), |
|
64 | + 'success' |
|
65 | + ); |
|
66 | 66 | |
67 | - return redirect(route(AdminConfigPage::class)); |
|
68 | - } |
|
67 | + return redirect(route(AdminConfigPage::class)); |
|
68 | + } |
|
69 | 69 | } |
@@ -53,7 +53,7 @@ |
||
53 | 53 | return redirect(route(AdminConfigPage::class)); |
54 | 54 | } |
55 | 55 | |
56 | - $params = (array) $request->getParsedBody(); |
|
56 | + $params = (array)$request->getParsedBody(); |
|
57 | 57 | |
58 | 58 | $this->module->setPreference('MAJ_TITLE_PREFIX', $params['MAJ_TITLE_PREFIX'] ?? ''); |
59 | 59 | $this->module->setPreference('MAJ_DISPLAY_CNIL', $params['MAJ_DISPLAY_CNIL'] ?? ''); |
@@ -28,35 +28,35 @@ |
||
28 | 28 | */ |
29 | 29 | class AdminConfigPage implements RequestHandlerInterface |
30 | 30 | { |
31 | - use ViewResponseTrait; |
|
32 | - |
|
33 | - private ?MiscExtensionsModule $module; |
|
34 | - |
|
35 | - /** |
|
36 | - * Constructor for AdminConfigPage Request Handler |
|
37 | - * |
|
38 | - * @param ModuleService $module_service |
|
39 | - */ |
|
40 | - public function __construct(ModuleService $module_service) |
|
41 | - { |
|
42 | - $this->module = $module_service->findByInterface(MiscExtensionsModule::class)->first(); |
|
43 | - } |
|
44 | - |
|
45 | - /** |
|
46 | - * {@inheritDoc} |
|
47 | - * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
48 | - */ |
|
49 | - public function handle(ServerRequestInterface $request): ResponseInterface |
|
50 | - { |
|
51 | - $this->layout = 'layouts/administration'; |
|
52 | - |
|
53 | - if ($this->module === null) { |
|
54 | - throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
55 | - } |
|
56 | - |
|
57 | - return $this->viewResponse($this->module->name() . '::admin/config', [ |
|
58 | - 'module' => $this->module, |
|
59 | - 'title' => $this->module->title() |
|
60 | - ]); |
|
61 | - } |
|
31 | + use ViewResponseTrait; |
|
32 | + |
|
33 | + private ?MiscExtensionsModule $module; |
|
34 | + |
|
35 | + /** |
|
36 | + * Constructor for AdminConfigPage Request Handler |
|
37 | + * |
|
38 | + * @param ModuleService $module_service |
|
39 | + */ |
|
40 | + public function __construct(ModuleService $module_service) |
|
41 | + { |
|
42 | + $this->module = $module_service->findByInterface(MiscExtensionsModule::class)->first(); |
|
43 | + } |
|
44 | + |
|
45 | + /** |
|
46 | + * {@inheritDoc} |
|
47 | + * @see \Psr\Http\Server\RequestHandlerInterface::handle() |
|
48 | + */ |
|
49 | + public function handle(ServerRequestInterface $request): ResponseInterface |
|
50 | + { |
|
51 | + $this->layout = 'layouts/administration'; |
|
52 | + |
|
53 | + if ($this->module === null) { |
|
54 | + throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
|
55 | + } |
|
56 | + |
|
57 | + return $this->viewResponse($this->module->name() . '::admin/config', [ |
|
58 | + 'module' => $this->module, |
|
59 | + 'title' => $this->module->title() |
|
60 | + ]); |
|
61 | + } |
|
62 | 62 | } |
@@ -54,7 +54,7 @@ |
||
54 | 54 | throw new HttpNotFoundException(I18N::translate('The attached module could not be found.')); |
55 | 55 | } |
56 | 56 | |
57 | - return $this->viewResponse($this->module->name() . '::admin/config', [ |
|
57 | + return $this->viewResponse($this->module->name().'::admin/config', [ |
|
58 | 58 | 'module' => $this->module, |
59 | 59 | 'title' => $this->module->title() |
60 | 60 | ]); |
@@ -32,89 +32,89 @@ |
||
32 | 32 | * Provide miscellaneous improvements to webtrees. |
33 | 33 | */ |
34 | 34 | class MiscExtensionsModule extends AbstractModule implements |
35 | - ModuleMyArtJaubInterface, |
|
36 | - ModuleConfigInterface, |
|
37 | - ModuleHookSubscriberInterface |
|
35 | + ModuleMyArtJaubInterface, |
|
36 | + ModuleConfigInterface, |
|
37 | + ModuleHookSubscriberInterface |
|
38 | 38 | { |
39 | - use ModuleMyArtJaubTrait { |
|
40 | - boot as traitBoot; |
|
41 | - } |
|
42 | - use ModuleConfigTrait; |
|
39 | + use ModuleMyArtJaubTrait { |
|
40 | + boot as traitBoot; |
|
41 | + } |
|
42 | + use ModuleConfigTrait; |
|
43 | 43 | |
44 | - /** |
|
45 | - * {@inheritDoc} |
|
46 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
|
47 | - */ |
|
48 | - public function title(): string |
|
49 | - { |
|
50 | - return /* I18N: Name of the “MiscExtensions” module */ I18N::translate('Miscellaneous extensions'); |
|
51 | - } |
|
44 | + /** |
|
45 | + * {@inheritDoc} |
|
46 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
|
47 | + */ |
|
48 | + public function title(): string |
|
49 | + { |
|
50 | + return /* I18N: Name of the “MiscExtensions” module */ I18N::translate('Miscellaneous extensions'); |
|
51 | + } |
|
52 | 52 | |
53 | - /** |
|
54 | - * {@inheritDoc} |
|
55 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::description() |
|
56 | - */ |
|
57 | - public function description(): string |
|
58 | - { |
|
59 | - //phpcs:ignore Generic.Files.LineLength.TooLong |
|
60 | - return /* I18N: Description of the “MiscExtensions” module */ I18N::translate('Miscellaneous extensions for webtrees.'); |
|
61 | - } |
|
53 | + /** |
|
54 | + * {@inheritDoc} |
|
55 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::description() |
|
56 | + */ |
|
57 | + public function description(): string |
|
58 | + { |
|
59 | + //phpcs:ignore Generic.Files.LineLength.TooLong |
|
60 | + return /* I18N: Description of the “MiscExtensions” module */ I18N::translate('Miscellaneous extensions for webtrees.'); |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * {@inheritDoc} |
|
65 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::boot() |
|
66 | - */ |
|
67 | - public function boot(): void |
|
68 | - { |
|
69 | - $this->traitBoot(); |
|
70 | - View::registerCustomView('::modules/privacy-policy/page', $this->name() . '::privacy-policy'); |
|
71 | - } |
|
63 | + /** |
|
64 | + * {@inheritDoc} |
|
65 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::boot() |
|
66 | + */ |
|
67 | + public function boot(): void |
|
68 | + { |
|
69 | + $this->traitBoot(); |
|
70 | + View::registerCustomView('::modules/privacy-policy/page', $this->name() . '::privacy-policy'); |
|
71 | + } |
|
72 | 72 | |
73 | - /** |
|
74 | - * {@inheritDoc} |
|
75 | - * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes() |
|
76 | - */ |
|
77 | - public function loadRoutes(Map $router): void |
|
78 | - { |
|
79 | - $router->attach('', '', static function (Map $router): void { |
|
73 | + /** |
|
74 | + * {@inheritDoc} |
|
75 | + * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes() |
|
76 | + */ |
|
77 | + public function loadRoutes(Map $router): void |
|
78 | + { |
|
79 | + $router->attach('', '', static function (Map $router): void { |
|
80 | 80 | |
81 | - $router->attach('', '/module-maj/misc', static function (Map $router): void { |
|
81 | + $router->attach('', '/module-maj/misc', static function (Map $router): void { |
|
82 | 82 | |
83 | - $router->attach('', '/config/admin', static function (Map $router): void { |
|
83 | + $router->attach('', '/config/admin', static function (Map $router): void { |
|
84 | 84 | |
85 | - $router->get(AdminConfigPage::class, '', AdminConfigPage::class); |
|
86 | - $router->post(AdminConfigAction::class, '', AdminConfigAction::class); |
|
87 | - }); |
|
88 | - }); |
|
89 | - }); |
|
90 | - } |
|
85 | + $router->get(AdminConfigPage::class, '', AdminConfigPage::class); |
|
86 | + $router->post(AdminConfigAction::class, '', AdminConfigAction::class); |
|
87 | + }); |
|
88 | + }); |
|
89 | + }); |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * {@inheritDoc} |
|
94 | - * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion() |
|
95 | - */ |
|
96 | - public function customModuleVersion(): string |
|
97 | - { |
|
98 | - return '2.1.0-v.1'; |
|
99 | - } |
|
92 | + /** |
|
93 | + * {@inheritDoc} |
|
94 | + * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion() |
|
95 | + */ |
|
96 | + public function customModuleVersion(): string |
|
97 | + { |
|
98 | + return '2.1.0-v.1'; |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * {@inheritDoc} |
|
103 | - * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
104 | - */ |
|
105 | - public function getConfigLink(): string |
|
106 | - { |
|
107 | - return route(AdminConfigPage::class); |
|
108 | - } |
|
101 | + /** |
|
102 | + * {@inheritDoc} |
|
103 | + * @see \Fisharebest\Webtrees\Module\ModuleConfigInterface::getConfigLink() |
|
104 | + */ |
|
105 | + public function getConfigLink(): string |
|
106 | + { |
|
107 | + return route(AdminConfigPage::class); |
|
108 | + } |
|
109 | 109 | |
110 | - /** |
|
111 | - * {@inheritDoc} |
|
112 | - * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks() |
|
113 | - */ |
|
114 | - public function listSubscribedHooks(): array |
|
115 | - { |
|
116 | - return [ |
|
117 | - app()->makeWith(TitlesCardHook::class, [ 'module' => $this ]) |
|
118 | - ]; |
|
119 | - } |
|
110 | + /** |
|
111 | + * {@inheritDoc} |
|
112 | + * @see \MyArtJaub\Webtrees\Contracts\Hooks\ModuleHookSubscriberInterface::listSubscribedHooks() |
|
113 | + */ |
|
114 | + public function listSubscribedHooks(): array |
|
115 | + { |
|
116 | + return [ |
|
117 | + app()->makeWith(TitlesCardHook::class, [ 'module' => $this ]) |
|
118 | + ]; |
|
119 | + } |
|
120 | 120 | } |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | public function boot(): void |
68 | 68 | { |
69 | 69 | $this->traitBoot(); |
70 | - View::registerCustomView('::modules/privacy-policy/page', $this->name() . '::privacy-policy'); |
|
70 | + View::registerCustomView('::modules/privacy-policy/page', $this->name().'::privacy-policy'); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | /** |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | */ |
77 | 77 | public function loadRoutes(Map $router): void |
78 | 78 | { |
79 | - $router->attach('', '', static function (Map $router): void { |
|
79 | + $router->attach('', '', static function(Map $router): void { |
|
80 | 80 | |
81 | - $router->attach('', '/module-maj/misc', static function (Map $router): void { |
|
81 | + $router->attach('', '/module-maj/misc', static function(Map $router): void { |
|
82 | 82 | |
83 | - $router->attach('', '/config/admin', static function (Map $router): void { |
|
83 | + $router->attach('', '/config/admin', static function(Map $router): void { |
|
84 | 84 | |
85 | 85 | $router->get(AdminConfigPage::class, '', AdminConfigPage::class); |
86 | 86 | $router->post(AdminConfigAction::class, '', AdminConfigAction::class); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | public function listSubscribedHooks(): array |
115 | 115 | { |
116 | 116 | return [ |
117 | - app()->makeWith(TitlesCardHook::class, [ 'module' => $this ]) |
|
117 | + app()->makeWith(TitlesCardHook::class, ['module' => $this]) |
|
118 | 118 | ]; |
119 | 119 | } |
120 | 120 | } |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function boot(): void |
35 | 35 | { |
36 | - View::registerNamespace($this->name(), $this->resourcesFolder() . 'views/'); |
|
36 | + View::registerNamespace($this->name(), $this->resourcesFolder().'views/'); |
|
37 | 37 | |
38 | 38 | $this->loadRoutes(app(RouterContainer::class)->getMap()); |
39 | 39 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | */ |
44 | 44 | public function resourcesFolder(): string |
45 | 45 | { |
46 | - return Webtrees::MODULES_DIR . trim($this->name(), '_') . '/resources/'; |
|
46 | + return Webtrees::MODULES_DIR.trim($this->name(), '_').'/resources/'; |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | /** |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | public function customTranslations(string $language): array |
71 | 71 | { |
72 | - $translation_file = $this->resourcesFolder() . 'lang/' . $language . '/messages.php'; |
|
72 | + $translation_file = $this->resourcesFolder().'lang/'.$language.'/messages.php'; |
|
73 | 73 | |
74 | 74 | try { |
75 | 75 | $translation = new Translation($translation_file); |
@@ -94,10 +94,10 @@ discard block |
||
94 | 94 | { |
95 | 95 | /** @var ModuleThemeInterface $theme */ |
96 | 96 | $theme = app(ModuleThemeInterface::class); |
97 | - $css_file = $this->resourcesFolder() . 'css/' . $theme->name() . '.min.css'; |
|
97 | + $css_file = $this->resourcesFolder().'css/'.$theme->name().'.min.css'; |
|
98 | 98 | |
99 | 99 | if (file_exists($css_file)) { |
100 | - return $this->assetUrl('css/' . $theme->name() . '.min.css'); |
|
100 | + return $this->assetUrl('css/'.$theme->name().'.min.css'); |
|
101 | 101 | } else { |
102 | 102 | return $this->assetUrl('css/default.min.css'); |
103 | 103 | } |
@@ -26,82 +26,82 @@ |
||
26 | 26 | */ |
27 | 27 | trait ModuleMyArtJaubTrait |
28 | 28 | { |
29 | - use ModuleCustomTrait; |
|
30 | - |
|
31 | - /** |
|
32 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::boot() |
|
33 | - */ |
|
34 | - public function boot(): void |
|
35 | - { |
|
36 | - View::registerNamespace($this->name(), $this->resourcesFolder() . 'views/'); |
|
37 | - |
|
38 | - $this->loadRoutes(app(RouterContainer::class)->getMap()); |
|
39 | - } |
|
40 | - |
|
41 | - /** |
|
42 | - * @see \Fisharebest\Webtrees\Module\AbstractModule::resourcesFolder() |
|
43 | - */ |
|
44 | - public function resourcesFolder(): string |
|
45 | - { |
|
46 | - return Webtrees::MODULES_DIR . trim($this->name(), '_') . '/resources/'; |
|
47 | - } |
|
48 | - |
|
49 | - /** |
|
50 | - * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleAuthorName() |
|
51 | - */ |
|
52 | - public function customModuleAuthorName(): string |
|
53 | - { |
|
54 | - return 'Jonathan Jaubart'; |
|
55 | - } |
|
56 | - |
|
57 | - /** |
|
58 | - * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleSupportUrl() |
|
59 | - */ |
|
60 | - public function customModuleSupportUrl(): string |
|
61 | - { |
|
62 | - return 'https://github.com/jon48/webtrees-lib'; |
|
63 | - } |
|
64 | - |
|
65 | - /** |
|
66 | - * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customTranslations() |
|
67 | - * |
|
68 | - * @return array<string, string> |
|
69 | - */ |
|
70 | - public function customTranslations(string $language): array |
|
71 | - { |
|
72 | - $translation_file = $this->resourcesFolder() . 'lang/' . $language . '/messages.php'; |
|
73 | - |
|
74 | - try { |
|
75 | - $translation = new Translation($translation_file); |
|
76 | - return $translation->asArray(); |
|
77 | - } catch (\Exception $e) { |
|
78 | - } |
|
79 | - |
|
80 | - return []; |
|
81 | - } |
|
82 | - |
|
83 | - /** |
|
84 | - * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes |
|
85 | - * |
|
86 | - * @param Map<\Aura\Router\Route> $router |
|
87 | - */ |
|
88 | - public function loadRoutes(Map $router): void |
|
89 | - { |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::moduleCssUrl |
|
94 | - */ |
|
95 | - public function moduleCssUrl(): string |
|
96 | - { |
|
97 | - /** @var ModuleThemeInterface $theme */ |
|
98 | - $theme = app(ModuleThemeInterface::class); |
|
99 | - $css_file = $this->resourcesFolder() . 'css/' . $theme->name() . '.min.css'; |
|
100 | - |
|
101 | - if (file_exists($css_file)) { |
|
102 | - return $this->assetUrl('css/' . $theme->name() . '.min.css'); |
|
103 | - } else { |
|
104 | - return $this->assetUrl('css/default.min.css'); |
|
105 | - } |
|
106 | - } |
|
29 | + use ModuleCustomTrait; |
|
30 | + |
|
31 | + /** |
|
32 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::boot() |
|
33 | + */ |
|
34 | + public function boot(): void |
|
35 | + { |
|
36 | + View::registerNamespace($this->name(), $this->resourcesFolder() . 'views/'); |
|
37 | + |
|
38 | + $this->loadRoutes(app(RouterContainer::class)->getMap()); |
|
39 | + } |
|
40 | + |
|
41 | + /** |
|
42 | + * @see \Fisharebest\Webtrees\Module\AbstractModule::resourcesFolder() |
|
43 | + */ |
|
44 | + public function resourcesFolder(): string |
|
45 | + { |
|
46 | + return Webtrees::MODULES_DIR . trim($this->name(), '_') . '/resources/'; |
|
47 | + } |
|
48 | + |
|
49 | + /** |
|
50 | + * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleAuthorName() |
|
51 | + */ |
|
52 | + public function customModuleAuthorName(): string |
|
53 | + { |
|
54 | + return 'Jonathan Jaubart'; |
|
55 | + } |
|
56 | + |
|
57 | + /** |
|
58 | + * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleSupportUrl() |
|
59 | + */ |
|
60 | + public function customModuleSupportUrl(): string |
|
61 | + { |
|
62 | + return 'https://github.com/jon48/webtrees-lib'; |
|
63 | + } |
|
64 | + |
|
65 | + /** |
|
66 | + * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customTranslations() |
|
67 | + * |
|
68 | + * @return array<string, string> |
|
69 | + */ |
|
70 | + public function customTranslations(string $language): array |
|
71 | + { |
|
72 | + $translation_file = $this->resourcesFolder() . 'lang/' . $language . '/messages.php'; |
|
73 | + |
|
74 | + try { |
|
75 | + $translation = new Translation($translation_file); |
|
76 | + return $translation->asArray(); |
|
77 | + } catch (\Exception $e) { |
|
78 | + } |
|
79 | + |
|
80 | + return []; |
|
81 | + } |
|
82 | + |
|
83 | + /** |
|
84 | + * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::loadRoutes |
|
85 | + * |
|
86 | + * @param Map<\Aura\Router\Route> $router |
|
87 | + */ |
|
88 | + public function loadRoutes(Map $router): void |
|
89 | + { |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * @see \MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface::moduleCssUrl |
|
94 | + */ |
|
95 | + public function moduleCssUrl(): string |
|
96 | + { |
|
97 | + /** @var ModuleThemeInterface $theme */ |
|
98 | + $theme = app(ModuleThemeInterface::class); |
|
99 | + $css_file = $this->resourcesFolder() . 'css/' . $theme->name() . '.min.css'; |
|
100 | + |
|
101 | + if (file_exists($css_file)) { |
|
102 | + return $this->assetUrl('css/' . $theme->name() . '.min.css'); |
|
103 | + } else { |
|
104 | + return $this->assetUrl('css/default.min.css'); |
|
105 | + } |
|
106 | + } |
|
107 | 107 | } |