diff options
| -rw-r--r-- | app/Module/ModuleCustomTrait.php | 10 | ||||
| -rw-r--r-- | modules_v4/example.module/module.php | 68 | ||||
| -rw-r--r-- | resources/views/admin/custom-module-info.phtml | 23 |
3 files changed, 90 insertions, 11 deletions
diff --git a/app/Module/ModuleCustomTrait.php b/app/Module/ModuleCustomTrait.php index 5780e2548a..929a372684 100644 --- a/app/Module/ModuleCustomTrait.php +++ b/app/Module/ModuleCustomTrait.php @@ -29,17 +29,17 @@ trait ModuleCustomTrait */ public function customModuleAuthorName(): string { - return 'Unknown author'; + return ''; } /** * The version of this module. * - * @return string + * @return string e.g. '1.2.3' */ public function customModuleVersion(): string { - return '0.0.0'; + return ''; } /** @@ -49,7 +49,7 @@ trait ModuleCustomTrait */ public function customModuleLatestVersionUrl(): string { - return 'https://www.exmaple.com/latest-version'; + return ''; } /** @@ -59,6 +59,6 @@ trait ModuleCustomTrait */ public function customModuleSupportUrl(): string { - return 'https://www.exmaple.com/support'; + return ''; } } diff --git a/modules_v4/example.module/module.php b/modules_v4/example.module/module.php new file mode 100644 index 0000000000..54ac589824 --- /dev/null +++ b/modules_v4/example.module/module.php @@ -0,0 +1,68 @@ +<?php +use Fisharebest\Webtrees\Module\AbstractModule; +use Fisharebest\Webtrees\Module\ModuleCustomInterface; +use Fisharebest\Webtrees\Module\ModuleCustomTrait; + +return new class extends AbstractModule implements ModuleCustomInterface { + use ModuleCustomTrait; + + /** + * How should this module be labelled on tabs, menus, etc.? + * + * @return string + */ + public function title(): string + { + return 'My Custom module'; + } + + /** + * A sentence describing what this module does. + * + * @return string + */ + public function description(): string + { + return 'This module doesnât do anything'; + } + + /** + * The person or organisation who created this module. + * + * @return string + */ + public function customModuleAuthorName(): string + { + return 'Greg Roach'; + } + + /** + * The version of this module. + * + * @return string + */ + public function customModuleVersion(): string + { + return '1.0.0'; + } + + /** + * A URL that will provide the latest version of this module. + * + * @return string + */ + public function customModuleLatestVersionUrl(): string + { + return 'https://www.webtrees.net'; + } + + /** + * Where to get support for this module. Perhaps a github respository? + * + * @return string + */ + public function customModuleSupportUrl(): string + { + return 'https://www.example.com/support'; + } +}; diff --git a/resources/views/admin/custom-module-info.phtml b/resources/views/admin/custom-module-info.phtml index 410a728ada..d9dd22f268 100644 --- a/resources/views/admin/custom-module-info.phtml +++ b/resources/views/admin/custom-module-info.phtml @@ -1,19 +1,30 @@ <?php use Fisharebest\Webtrees\I18N; +use Fisharebest\Webtrees\Module\ModuleCustomInterface; + +/** @var ModuleCustomInterface $module */ ?> <div class="wt-custom-module-info"> <?= view('icons/warning') ?> <?= I18N::translate('Custom module') ?> - <?php if ($module::CUSTOM_VERSION) : ?> - - <?= I18N::translate('Version') ?> <?= $module::CUSTOM_VERSION ?> + <?php if ($module->customModuleVersion() !== '') : ?> + <br> + <?= view('icons/module') ?> + <?= $module->customModuleVersion() ?> + <?php endif ?> + <?php if ($module->customModuleAuthorName() !== '') : ?> + <br> + <?= view('icons/individual') ?> + <?= $module->customModuleAuthorName() ?> <?php endif ?> - <?php if ($module::CUSTOM_WEBSITE) : ?> - - - <a href="<?= $module::CUSTOM_WEBSITE ?>"> - <?= $module::CUSTOM_WEBSITE ?> + <?php if ($module->customModuleSupportUrl() !== '') : ?> + <br> + <?= view('icons/help') ?> + <a href="<?= e($module->customModuleSupportUrl()) ?>"> + <?= e($module->customModuleSupportUrl()) ?> </a> <?php endif ?> </div> |
