Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save junaidpv/95cfdb146ea86fcf2627173cf3df1a81 to your computer and use it in GitHub Desktop.
Save junaidpv/95cfdb146ea86fcf2627173cf3df1a81 to your computer and use it in GitHub Desktop.
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