diff --git a/module/VuFind/src/VuFind/Controller/AbstractRecord.php b/module/VuFind/src/VuFind/Controller/AbstractRecord.php index a0176ad9df02a8acbd89840f04c9c3da9e321966..28fcf35d3bde9967b0d6d17020b51107d6587193 100644 --- a/module/VuFind/src/VuFind/Controller/AbstractRecord.php +++ b/module/VuFind/src/VuFind/Controller/AbstractRecord.php @@ -516,10 +516,12 @@ class AbstractRecord extends AbstractBase protected function getAllTabs() { if (null === $this->allTabs) { + $driver = $this->loadRecord(); $cfg = $this->getServiceLocator()->get('Config'); + $request = $this->getRequest(); $this->allTabs = $this->getServiceLocator() ->get('VuFind\RecordTabPluginManager') - ->getTabsForRecord($this->loadRecord(), $cfg['recorddriver_tabs']); + ->getTabsForRecord($driver, $cfg['recorddriver_tabs'], $request); } return $this->allTabs; } diff --git a/module/VuFind/src/VuFind/RecordTab/AbstractBase.php b/module/VuFind/src/VuFind/RecordTab/AbstractBase.php index c77ca39b1e243084e6bbfde7f70da8d89ae043fa..db509b6a0678d5585fb25122bc3a0cfd0beef785 100644 --- a/module/VuFind/src/VuFind/RecordTab/AbstractBase.php +++ b/module/VuFind/src/VuFind/RecordTab/AbstractBase.php @@ -45,6 +45,13 @@ abstract class AbstractBase implements TabInterface */ protected $driver = null; + /** + * User request associated with the tab (false for none) + * + * @var \Zend\Http\Request|bool + */ + protected $request = false; + /** * Is this tab active? * @@ -82,4 +89,27 @@ abstract class AbstractBase implements TabInterface } return $this->driver; } + + /** + * Set the user request + * + * @param \Zend\Http\Request $request Request + * + * @return AbstractBase + */ + public function setRequest(\Zend\Http\Request $request) + { + $this->request = $request; + return $this; + } + + /** + * Get the user request (or false if unavailable) + * + * @return \Zend\Http\Request|bool + */ + protected function getRequest() + { + return $this->request; + } } \ No newline at end of file diff --git a/module/VuFind/src/VuFind/RecordTab/PluginManager.php b/module/VuFind/src/VuFind/RecordTab/PluginManager.php index 76560042652682e88c9a4134f06b0a4b9e0574d6..cfaf29256793be990bb05600f685c9bd52365893 100644 --- a/module/VuFind/src/VuFind/RecordTab/PluginManager.php +++ b/module/VuFind/src/VuFind/RecordTab/PluginManager.php @@ -81,14 +81,15 @@ class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager /** * Get an array of valid tabs for the provided record driver. * - * @param \VuFind\RecordDriver\AbstractBase $driver Record driver - * @param array $config Tab configuration (map of + * @param \VuFind\RecordDriver\AbstractBase $driver Record driver + * @param array $config Tab configuration (map of * driver class => tab service name + * @param \Zend\Http\Request $request User request (optional) * * @return array service name => tab object */ public function getTabsForRecord(\VuFind\RecordDriver\AbstractBase $driver, - array $config + array $config, $request = null ) { $tabs = array(); foreach ($this->getTabServiceNames($driver, $config) as $tabKey => $svc) { @@ -99,6 +100,11 @@ class PluginManager extends \VuFind\ServiceManager\AbstractPluginManager if (method_exists($newTab, 'setRecordDriver')) { $newTab->setRecordDriver($driver); } + if ($request instanceof \Zend\Http\Request + && method_exists($newTab, 'setRequest') + ) { + $newTab->setRequest($request); + } if ($newTab->isActive()) { $tabs[$tabKey] = $newTab; }