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

More ConfigReader decoupling.

parent a594e0c9
No related merge requests found
...@@ -26,8 +26,7 @@ ...@@ -26,8 +26,7 @@
* @link http://vufind.org/wiki/vufind2:developer_manual Wiki * @link http://vufind.org/wiki/vufind2:developer_manual Wiki
*/ */
namespace VuFind\View\Helper\Root; namespace VuFind\View\Helper\Root;
use VuFind\Config\Reader as ConfigReader, Zend\View\Exception\RuntimeException, use Zend\View\Exception\RuntimeException, Zend\View\Helper\AbstractHelper;
Zend\View\Helper\AbstractHelper;
/** /**
* Record driver view helper * Record driver view helper
...@@ -40,9 +39,37 @@ use VuFind\Config\Reader as ConfigReader, Zend\View\Exception\RuntimeException, ...@@ -40,9 +39,37 @@ use VuFind\Config\Reader as ConfigReader, Zend\View\Exception\RuntimeException,
*/ */
class Record extends AbstractHelper class Record extends AbstractHelper
{ {
/**
* Context view helper
*
* @var \VuFind\View\Helper\Root\Context
*/
protected $contextHelper; protected $contextHelper;
/**
* Record driver
*
* @var \VuFind\RecordDriver\AbstractBase
*/
protected $driver; protected $driver;
/**
* VuFind configuration
*
* @var \Zend\Config\Config
*/
protected $config;
/**
* Constructor
*
* @param \Zend\Config\Config $config VuFind configuration
*/
public function __construct($config = null)
{
$this->config = $config;
}
/** /**
* Render a template within a record driver folder. * Render a template within a record driver folder.
* *
...@@ -213,10 +240,9 @@ class Record extends AbstractHelper ...@@ -213,10 +240,9 @@ class Record extends AbstractHelper
*/ */
public function getPreviews() public function getPreviews()
{ {
$config = ConfigReader::getConfig();
return $this->renderTemplate( return $this->renderTemplate(
'preview.phtml', 'preview.phtml',
array('driver' => $this->driver, 'config' => $config) array('driver' => $this->driver, 'config' => $this->config)
); );
} }
......
...@@ -33,6 +33,11 @@ return array( ...@@ -33,6 +33,11 @@ return array(
$sm->getServiceLocator()->get('VuFind\ILSConnection') $sm->getServiceLocator()->get('VuFind\ILSConnection')
); );
}, },
'record' => function ($sm) {
return new \VuFind\View\Helper\Root\Record(
\VuFind\Config\Reader::getConfig()
);
},
'recordlink' => function ($sm) { 'recordlink' => function ($sm) {
return new \VuFind\View\Helper\Root\RecordLink( return new \VuFind\View\Helper\Root\RecordLink(
$sm->getServiceLocator()->get('VuFind\RecordRouter') $sm->getServiceLocator()->get('VuFind\RecordRouter')
...@@ -67,7 +72,6 @@ return array( ...@@ -67,7 +72,6 @@ return array(
'printms' => 'VuFind\View\Helper\Root\Printms', 'printms' => 'VuFind\View\Helper\Root\Printms',
'proxyurl' => 'VuFind\View\Helper\Root\ProxyUrl', 'proxyurl' => 'VuFind\View\Helper\Root\ProxyUrl',
'recommend' => 'VuFind\View\Helper\Root\Recommend', 'recommend' => 'VuFind\View\Helper\Root\Recommend',
'record' => 'VuFind\View\Helper\Root\Record',
'related' => 'VuFind\View\Helper\Root\Related', 'related' => 'VuFind\View\Helper\Root\Related',
'renderarray' => 'VuFind\View\Helper\Root\RenderArray', 'renderarray' => 'VuFind\View\Helper\Root\RenderArray',
'resultfeed' => 'VuFind\View\Helper\Root\ResultFeed', 'resultfeed' => 'VuFind\View\Helper\Root\ResultFeed',
......
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