The Gitlab instance will be restarted on Monday April 28th at 2AM. There will be a short interruption of service.

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

Inject configuration.

parent c68b70fd
No related merge requests found
......@@ -656,12 +656,16 @@ $config = array(
}
return new \VuFind\RecordTab\HoldingsILS($catalog);
},
'map' => function ($sm) {
$config = $sm->getServiceLocator()->get('VuFind\Config')->get('config');
$enabled = isset($config->Content->recordMap);
return new \VuFind\RecordTab\Map($enabled);
},
),
'invokables' => array(
'description' => 'VuFind\RecordTab\Description',
'excerpt' => 'VuFind\RecordTab\Excerpt',
'holdingsworldcat' => 'VuFind\RecordTab\HoldingsWorldCat',
'map' => 'VuFind\RecordTab\Map',
'reviews' => 'VuFind\RecordTab\Reviews',
'staffviewarray' => 'VuFind\RecordTab\StaffViewArray',
'staffviewmarc' => 'VuFind\RecordTab\StaffViewMARC',
......
......@@ -26,7 +26,6 @@
* @link http://vufind.org/wiki/vufind2:record_tabs Wiki
*/
namespace VuFind\RecordTab;
use VuFind\Config\Reader as ConfigReader;
/**
* Map tab
......@@ -47,6 +46,23 @@ class Map extends AbstractBase
*/
protected $translator = null;
/**
* Is this module enabled in the configuration?
*
* @var bool
*/
protected $enabled;
/**
* Constructor
*
* @param bool $enabled Is this module enabled in the configuration?
*/
public function __construct($enabled = true)
{
$this->enabled = $enabled;
}
/**
* Get the on-screen description for this tab.
*
......@@ -121,8 +137,7 @@ class Map extends AbstractBase
*/
public function isActive()
{
$config = ConfigReader::getConfig();
if (!isset($config->Content->recordMap)) {
if (!$this->enabled) {
return false;
}
$longLat = $this->getRecordDriver()->tryMethod('getLongLat');
......
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