88
99namespace ExampleNamespace ;
1010
11- use Fisharebest \Webtrees \Contracts \ElementInterface ;
1211use Fisharebest \Webtrees \Elements \AddressWebPage ;
1312use Fisharebest \Webtrees \Elements \CustomElement ;
1413use Fisharebest \Webtrees \Elements \EmptyElement ;
1817use Fisharebest \Webtrees \I18N ;
1918use Fisharebest \Webtrees \Module \AbstractModule ;
2019use Fisharebest \Webtrees \Module \ModuleCustomInterface ;
21- use Fisharebest \Webtrees \Module \ModuleCustomTagsInterface ;
22- use Fisharebest \Webtrees \Module \ModuleCustomTagsTrait ;
2320use Fisharebest \Webtrees \Module \ModuleCustomTrait ;
21+ use Fisharebest \Webtrees \Registry ;
2422
2523/**
2624 * Class ExampleModuleCustomTags
3028 *
3129 * Modules *must* implement ModuleCustomInterface. They *may* also implement other interfaces.
3230 */
33- class ExampleModuleCustomTags extends AbstractModule implements ModuleCustomTagsInterface, ModuleCustomInterface
31+ class ExampleModuleCustomTags extends AbstractModule implements ModuleCustomInterface
3432{
3533 // For every module interface that is implemented, the corresponding trait *should* also use be used.
3634 use ModuleCustomTrait;
37- use ModuleCustomTagsTrait;
3835
3936 /**
4037 * How should this module be identified in the control panel, etc.?
@@ -117,10 +114,20 @@ public function customTranslations(string $language): array
117114 }
118115 }
119116
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+
120127 /**
121128 * @return array<string,ElementInterface>
122129 */
123- public function customTags (): array
130+ protected function customTags (): array
124131 {
125132 return [
126133 'FAM:DATA ' => new EmptyElement (I18N ::translate ('Data ' ), ['TEXT ' => '0:1 ' ]),
@@ -139,7 +146,7 @@ public function customTags(): array
139146 /**
140147 * @return array<string,array<int,array<int,string>>>
141148 */
142- public function customSubTags (): array
149+ protected function customSubTags (): array
143150 {
144151 return [
145152 'FAM ' => [['DATA ' , '0:M ' ]],
0 commit comments