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

Code simplification.

parent ef3c95d3
No related merge requests found
...@@ -145,13 +145,8 @@ class Factory ...@@ -145,13 +145,8 @@ class Factory
// ILS driver specifies no holdings, we need to pass in a connection // ILS driver specifies no holdings, we need to pass in a connection
// object: // object:
$config = $sm->get('VuFind\Config\PluginManager')->get('config'); $config = $sm->get('VuFind\Config\PluginManager')->get('config');
if (isset($config->Site->hideHoldingsTabWhenEmpty) $catalog = ($config->Site->hideHoldingsTabWhenEmpty ?? false)
&& $config->Site->hideHoldingsTabWhenEmpty ? $sm->get('VuFind\ILS\Connection') : null;
) {
$catalog = $sm->get('VuFind\ILS\Connection');
} else {
$catalog = false;
}
return new HoldingsILS($catalog); return new HoldingsILS($catalog);
} }
......
...@@ -39,9 +39,9 @@ namespace VuFind\RecordTab; ...@@ -39,9 +39,9 @@ namespace VuFind\RecordTab;
class HoldingsILS extends AbstractBase class HoldingsILS extends AbstractBase
{ {
/** /**
* ILS connection (or false if not applicable) * ILS connection (or null if not applicable)
* *
* @param \VuFind\ILS\Connection|bool * @param \VuFind\ILS\Connection
*/ */
protected $catalog; protected $catalog;
...@@ -49,12 +49,11 @@ class HoldingsILS extends AbstractBase ...@@ -49,12 +49,11 @@ class HoldingsILS extends AbstractBase
* Constructor * Constructor
* *
* @param \VuFind\ILS\Connection|bool $catalog ILS connection to use to check * @param \VuFind\ILS\Connection|bool $catalog ILS connection to use to check
* for holdings before displaying the tab; set to false if no check is needed * for holdings before displaying the tab; set to null if no check is needed
*/ */
public function __construct($catalog) public function __construct(\VuFind\ILS\Connection $catalog = null)
{ {
$this->catalog = ($catalog && $catalog instanceof \VuFind\ILS\Connection) $this->catalog = $catalog;
? $catalog : false;
} }
/** /**
......
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