Created
September 21, 2024 14:07
-
-
Save junaidpv/95cfdb146ea86fcf2627173cf3df1a81 to your computer and use it in GitHub Desktop.
To fix issue reported at https://forum.omeka.org/t/error-installing-version-4-1/22522/7 and https://gitlab.com/Daniel-KM/Omeka-S-module-CleanUrl/-/issues/25
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/config/module.config.php b/config/module.config.php | |
index 88b4c68..37e2414 100644 | |
--- a/config/module.config.php | |
+++ b/config/module.config.php | |
@@ -58,9 +58,9 @@ return [ | |
], | |
], | |
'controllers' => [ | |
- 'invokables' => [ | |
+ 'factories' => [ | |
// Override the page controller used for the root url. | |
- 'Omeka\Controller\Site\Page' => Controller\Site\PageController::class, | |
+ 'Omeka\Controller\Site\Page' => Service\Controller\Site\PageControllerFactory::class, | |
], | |
], | |
'router' => [ | |
diff --git a/src/Router/Http/CleanRoute.php b/src/Router/Http/CleanRoute.php | |
index e4c86cb..dd18999 100644 | |
--- a/src/Router/Http/CleanRoute.php | |
+++ b/src/Router/Http/CleanRoute.php | |
@@ -73,6 +73,8 @@ class CleanRoute implements RouteInterface | |
*/ | |
protected $assembledParams = []; | |
+ public $priority = NULL; | |
+ | |
/** | |
* @param array $routes | |
* @param array $routeAliases | |
diff --git a/src/Service/Controller/Site/PageControllerFactory.php b/src/Service/Controller/Site/PageControllerFactory.php | |
new file mode 100644 | |
index 0000000..221ba94 | |
--- /dev/null | |
+++ b/src/Service/Controller/Site/PageControllerFactory.php | |
@@ -0,0 +1,17 @@ | |
+<?php | |
+namespace CleanUrl\Service\Controller\Site; | |
+ | |
+use Interop\Container\ContainerInterface; | |
+// use Omeka\Controller\Site\PageController; | |
+use CleanUrl\Controller\Site\PageController; | |
+use Laminas\ServiceManager\Factory\FactoryInterface; | |
+use Omeka\Service\Controller\Site\PageControllerFactory as OmekaPageControllerFactory; | |
+ | |
+class PageControllerFactory extends OmekaPageControllerFactory | |
+{ | |
+ public function __invoke(ContainerInterface $services, $requestedName, array $options = null) | |
+ { | |
+ $currentTheme = $services->get('Omeka\Site\ThemeManager')->getCurrentTheme(); | |
+ return new PageController($currentTheme); | |
+ } | |
+} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment