Whilst small files can be uploaded to forum posts, if you have a custom theme or module to contribute please add it on the "Add-ons" page.
  • Page:
  • 1

TOPIC:

Custom Map Module 1 week 10 hours ago #1

  • olor
  • olor's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • chen guo
  • Posts: 130
I modified EsriMaps.php to a custom module to load localized map data:
declare(strict_types=1);

namespace MyCustomNamespace;
use Fisharebest\Webtrees\Module\AbstractModule;
use Fisharebest\Webtrees\Module\ModuleCustomInterface;
use Fisharebest\Webtrees\Module\ModuleCustomTrait;
use Fisharebest\Webtrees\Module\ModuleMapProviderTrait;
use Fisharebest\Webtrees\Module\ModuleMapProviderInterface;
use Fisharebest\Webtrees\I18N;


/**
 * Class QQMaps - use maps within webtrees
 */
class QqMaps extends AbstractModule implements ModuleCustomInterface,ModuleMapProviderInterface
{
    use ModuleCustomTrait;
    use ModuleMapProviderTrait;

    /**
     * Name of the map provider.
     *
     * @return string
     */
    public function title(): string
    {
        return /* I18N: Name of a mapping organisation */ I18N::translate('QQ-地图');
    }

and a fatal error occurred:

Fatal error in module: olor-module-qqmaps
TypeError: Fisharebest\Webtrees\Services\ModuleService::load(): Return value must be of type ?Fisharebest\Webtrees\Module\ModuleInterface, int returned in /www/wwwroot/zongpu.cn/chen/app/Services/ModuleService.php:722 Stack trace: #0 /www/wwwroot/zongpu.cn/chen/app/Services/ModuleService.php(696): Fisharebest\Webtrees\Services\ModuleService::load() #1 [internal function]: Fisharebest\Webtrees\Services\ModuleService::Fisharebest\Webtrees\Services\{closure}() #2 /www/wwwroot/zongpu.cn/chen/vendor/illuminate/collections/Collection.php(695): array_map() #3 /www/wwwroot/zongpu.cn/chen/app/Services/ModuleService.php(705): Illuminate\Support\Collection->map() #4 /www/wwwroot/zongpu.cn/chen/app/Services/ModuleService.php(617): Fisharebest\Webtrees\Services\ModuleService->customModules() #5 /www/wwwroot/zongpu.cn/chen/app/Cache.php(60): Fisharebest\Webtrees\Services\ModuleService->Fisharebest\Webtrees\Services\{closure}() #6 /www/wwwroot/zongpu.cn/chen/vendor/symfony/cache/Adapter/ArrayAdapter.php(84): Fisharebest\Webtrees\Cache::Fisharebest\Webtrees\{closure}() #7 /www/wwwroot/zongpu.cn/chen/app/Cache.php(61): Symfony\Component\Cache\Adapter\ArrayAdapter->get() #8 /www/wwwroot/zongpu.cn/chen/app/Services/ModuleService.php(650): Fisharebest\Webtrees\Cache->remember() #9 /www/wwwroot/zongpu.cn/chen/app/Services/ModuleService.php(573): Fisharebest\Webtrees\Services\ModuleService->all() #10 /www/wwwroot/zongpu.cn/chen/app/Http/Middleware/UseLanguage.php(84): Fisharebest\Webtrees\Services\ModuleService->findByInterface() #11 /www/wwwroot/zongpu.cn/chen/app/Http/Middleware/UseLanguage.php(63): Fisharebest\Webtrees\Http\Middleware\UseLanguage->languages() #12 /www/wwwroot/zongpu.cn/chen/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseLanguage->process() #13 /www/wwwroot/zongpu.cn/chen/app/Http/Middleware/UseSession.php(78): Middleland\Dispatcher->handle() #14 /www/wwwroot/zongpu.cn/chen/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseSession->process() #15 /www/wwwroot/zongpu.cn/chen/app/Http/Middleware/UpdateDatabaseSchema.php(57): Middleland\Dispatcher->handle() #16 /www/wwwroot/zongpu.cn/chen/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UpdateDatabaseSchema->process() #17 /www/wwwroot/zongpu.cn/chen/app/Http/Middleware/UseDatabase.php(122): Middleland\Dispatcher->handle() #18 /www/wwwroot/zongpu.cn/chen/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\UseDatabase->process() #19 /www/wwwroot/zongpu.cn/chen/app/Http/Middleware/BadBotBlocker.php(282): Middleland\Dispatcher->handle() #20 /www/wwwroot/zongpu.cn/chen/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\BadBotBlocker->process() #21 /www/wwwroot/zongpu.cn/chen/app/Http/Middleware/CompressResponse.php(73): Middleland\Dispatcher->handle() #22 /www/wwwroot/zongpu.cn/chen/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\CompressResponse->process() #23 /www/wwwroot/zongpu.cn/chen/app/Http/Middleware/ContentLength.php(40): Middleland\Dispatcher->handle() #24 /www/wwwroot/zongpu.cn/chen/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\ContentLength->process() #25 /www/wwwroot/zongpu.cn/chen/vendor/middlewares/client-ip/src/ClientIp.php(65): Middleland\Dispatcher->handle() #26 /www/wwwroot/zongpu.cn/chen/app/Http/Middleware/ClientIp.php(47): Middlewares\ClientIp->process() #27 /www/wwwroot/zongpu.cn/chen/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\ClientIp->process() #28 /www/wwwroot/zongpu.cn/chen/app/Http/Middleware/HandleExceptions.php(90): Middleland\Dispatcher->handle() #29 /www/wwwroot/zongpu.cn/chen/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\HandleExceptions->process() #30 /www/wwwroot/zongpu.cn/chen/app/Http/Middleware/BaseUrl.php(73): Middleland\Dispatcher->handle() #31 /www/wwwroot/zongpu.cn/chen/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\BaseUrl->process() #32 /www/wwwroot/zongpu.cn/chen/app/Http/Middleware/ReadConfigIni.php(68): Middleland\Dispatcher->handle() #33 /www/wwwroot/zongpu.cn/chen/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\ReadConfigIni->process() #34 /www/wwwroot/zongpu.cn/chen/app/Http/Middleware/SecurityHeaders.php(48): Middleland\Dispatcher->handle() #35 /www/wwwroot/zongpu.cn/chen/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\SecurityHeaders->process() #36 /www/wwwroot/zongpu.cn/chen/app/Http/Middleware/EmitResponse.php(57): Middleland\Dispatcher->handle() #37 /www/wwwroot/zongpu.cn/chen/vendor/oscarotero/middleland/src/Dispatcher.php(136): Fisharebest\Webtrees\Http\Middleware\EmitResponse->process() #38 /www/wwwroot/zongpu.cn/chen/vendor/oscarotero/middleland/src/Dispatcher.php(118): Middleland\Dispatcher->handle() #39 /www/wwwroot/zongpu.cn/chen/app/Webtrees.php(275): Middleland\Dispatcher->dispatch() #40 /www/wwwroot/zongpu.cn/chen/app/Webtrees.php(262): Fisharebest\Webtrees\Webtrees::dispatch() #41 /www/wwwroot/zongpu.cn/chen/index.php(51): Fisharebest\Webtrees\Webtrees->httpRequest() #42 {main}


How should we deal with this problem?

Please Log in or Create an account to join the conversation.

Last edit: by olor.

Custom Map Module 1 week 5 hours ago #2

  • ric2015
  • ric2015's Avatar
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 382

Return value must be of type ?Fisharebest\Webtrees\Module\ModuleInterface, int returned in /www/wwwroot/zongpu.cn/chen/app/Services/ModuleService.php:722

This indicates the return value of your module.php file is problematic. It should be something like
return new QqMaps();
( see e.g. here ).
Richard

webtrees 2.1.16 at cissee.de/webtrees2
Vesta custom modules (Classic Look & Feel, Gov4webtrees, Shared Places, Extended Relationships) available at cissee.de

Please Log in or Create an account to join the conversation.

Custom Map Module 1 week 3 hours ago #3

  • olor
  • olor's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
  • chen guo
  • Posts: 130
tank you!

Please Log in or Create an account to join the conversation.

Last edit: by olor.
  • Page:
  • 1
Powered by Kunena Forum