Skip to content

Commit

Permalink
Updated against webtrees v2.2.1
Browse files Browse the repository at this point in the history
Fixes #2

Tested webtrees v2.2.1 on PHP v8.3.14 and v8.4.2.  Checked with and without URL rewriting.  Tested webtrees v2.1.20 on PHP v8.3.14.
  • Loading branch information
miqrogroove committed Dec 3, 2024
1 parent 644b691 commit 94c5858
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Family Tree Home Page
Make your family tree appear on the front page for all site users.

This is a custom module for [webtrees v2.1](https://github.com/fisharebest/webtrees).
This is a custom module for [webtrees v2.1 and v2.2](https://github.com/fisharebest/webtrees).

Whenever someone visits your front page or signs in from the front page, they should land back on the front page again instead of seeing "My Page".

Expand Down
12 changes: 9 additions & 3 deletions module.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/*
Family Tree Home Page
Copyright (C) 2022 by Robert Chapin
Copyright (C) 2024 by Robert Chapin
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -26,7 +26,9 @@
use Fisharebest\Webtrees\Module\AbstractModule;
use Fisharebest\Webtrees\Module\ModuleCustomInterface;
use Fisharebest\Webtrees\Module\ModuleCustomTrait;
use Fisharebest\Webtrees\Registry;
use Fisharebest\Webtrees\Validator;
use Fisharebest\Webtrees\Webtrees;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
Expand All @@ -40,7 +42,11 @@
public function boot(): void
{
// Get the Webtrees router.
$router = app(RouterContainer::class)->getMap();
if (version_compare(Webtrees::VERSION, '2.2.0', '>=')) {
$router = Registry::container()->get(RouterContainer::class)->getMap();
} else {
$router = app(RouterContainer::class)->getMap();
}

// Retrieve the entire routing table.
$routes = $router->getRoutes();
Expand Down Expand Up @@ -114,7 +120,7 @@ public function customModuleAuthorName(): string
*/
public function customModuleVersion(): string
{
return '1.0.03';
return '1.0.04';
}

/**
Expand Down

0 comments on commit 94c5858

Please sign in to comment.