Skip to content
Snippets Groups Projects
Commit b9b76327 authored by Demian Katz's avatar Demian Katz
Browse files

Update VuFindTheme module for ServiceManager v3.

parent 2b5180d1
Branches
Tags
No related merge requests found
......@@ -89,12 +89,15 @@ class Module
{
return [
'factories' => [
'headLink' => 'VuFindTheme\View\Helper\Factory::getHeadLink',
'headScript' => 'VuFindTheme\View\Helper\Factory::getHeadScript',
'headThemeResources' =>
'VuFindTheme\View\Helper\Factory::getHeadThemeResources',
'imageLink' => 'VuFindTheme\View\Helper\Factory::getImageLink',
'inlineScript' =>
// We have to override the Zend helpers using canonical names:
'Zend\View\Helper\HeadLink' =>
'VuFindTheme\View\Helper\Factory::getHeadLink',
'Zend\View\Helper\HeadScript' =>
'VuFindTheme\View\Helper\Factory::getHeadScript',
'Zend\View\Helper\InlineScript' =>
'VuFindTheme\View\Helper\Factory::getInlineScript',
],
];
......
......@@ -54,17 +54,18 @@ class InjectTemplateListener extends \Zend\Mvc\View\Http\InjectTemplateListener
}
/**
* Determine the top-level namespace of the controller
* Strip namespace part off controller name for compatibility with theme
* system.
*
* @param string $controller Controller name
* @param string $controller controller FQCN
*
* @return string
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @return string|false template name or false if controller was not matched
*/
protected function deriveModuleNamespace($controller)
public function mapController($controller)
{
// Namespaces just make the theme system more confusing; ignore them:
return '';
$initial = parent::mapController($controller);
$parts = explode('/', $initial);
array_shift($parts);
return implode('/', $parts);
}
}
......@@ -49,7 +49,7 @@ class ThemeInjectTemplateListenerTest extends Unit\TestCase
{
$l = new InjectTemplateListener();
$this->assertEquals(
'', $this->callMethod($l, 'deriveModuleNamespace', ['dummy'])
'search', $l->mapController('VuFind\Controller\SearchController')
);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment