diff --git a/module/VuFind/src/VuFind/Cover/RouterFactory.php b/module/VuFind/src/VuFind/Cover/RouterFactory.php index 53d9d8351cc006dfe3dcc307d105f4279dd4d831..431a226cc6ec28f5ee86043379c7ec27d8c44f69 100644 --- a/module/VuFind/src/VuFind/Cover/RouterFactory.php +++ b/module/VuFind/src/VuFind/Cover/RouterFactory.php @@ -61,8 +61,15 @@ class RouterFactory implements FactoryInterface if (!empty($options)) { throw new \Exception('Unexpected options sent to factory.'); } - $base = $container->get('ControllerPluginManager')->get('url') - ->fromRoute('cover-show'); + // Try to get the base URL from the controller plugin; fail over to + // the view helper if that doesn't work. + try { + $base = $container->get('ControllerPluginManager')->get('url') + ->fromRoute('cover-show'); + } catch (\Exception $e) { + $base = $container->get('ViewRenderer')->plugin('url') + ->__invoke('cover-show'); + } return new $requestedName($base); } }