8
8
9
9
namespace ExampleNamespace ;
10
10
11
- use Fisharebest \Webtrees \Contracts \ElementInterface ;
12
11
use Fisharebest \Webtrees \Elements \AddressWebPage ;
13
12
use Fisharebest \Webtrees \Elements \CustomElement ;
14
13
use Fisharebest \Webtrees \Elements \EmptyElement ;
18
17
use Fisharebest \Webtrees \I18N ;
19
18
use Fisharebest \Webtrees \Module \AbstractModule ;
20
19
use Fisharebest \Webtrees \Module \ModuleCustomInterface ;
21
- use Fisharebest \Webtrees \Module \ModuleCustomTagsInterface ;
22
- use Fisharebest \Webtrees \Module \ModuleCustomTagsTrait ;
23
20
use Fisharebest \Webtrees \Module \ModuleCustomTrait ;
21
+ use Fisharebest \Webtrees \Registry ;
24
22
25
23
/**
26
24
* Class ExampleModuleCustomTags
30
28
*
31
29
* Modules *must* implement ModuleCustomInterface. They *may* also implement other interfaces.
32
30
*/
33
- class ExampleModuleCustomTags extends AbstractModule implements ModuleCustomTagsInterface, ModuleCustomInterface
31
+ class ExampleModuleCustomTags extends AbstractModule implements ModuleCustomInterface
34
32
{
35
33
// For every module interface that is implemented, the corresponding trait *should* also use be used.
36
34
use ModuleCustomTrait;
37
- use ModuleCustomTagsTrait;
38
35
39
36
/**
40
37
* How should this module be identified in the control panel, etc.?
@@ -117,10 +114,20 @@ public function customTranslations(string $language): array
117
114
}
118
115
}
119
116
117
+ /**
118
+ * Called for all *enabled* modules.
119
+ */
120
+ public function boot (): void
121
+ {
122
+ $ elementFactory = Registry::elementFactory ();
123
+ $ elementFactory ->registerTags ($ this ->customTags ());
124
+ $ elementFactory ->registerSubTags ($ this ->customSubTags ());
125
+ }
126
+
120
127
/**
121
128
* @return array<string,ElementInterface>
122
129
*/
123
- public function customTags (): array
130
+ protected function customTags (): array
124
131
{
125
132
return [
126
133
'FAM:DATA ' => new EmptyElement (I18N ::translate ('Data ' ), ['TEXT ' => '0:1 ' ]),
@@ -139,7 +146,7 @@ public function customTags(): array
139
146
/**
140
147
* @return array<string,array<int,array<int,string>>>
141
148
*/
142
- public function customSubTags (): array
149
+ protected function customSubTags (): array
143
150
{
144
151
return [
145
152
'FAM ' => [['DATA ' , '0:M ' ]],
0 commit comments