diff --git a/config/vufind/channels.ini b/config/vufind/channels.ini index 85d173e7e3f..de154d64749 100644 --- a/config/vufind/channels.ini +++ b/config/vufind/channels.ini @@ -15,6 +15,14 @@ default_home_source = "Solr" ; Should we cache channel results on the Channels/Home screen? cache_home_channels = true +; This section controls behavior of the Channels record tab. +[RecordTab] +; What text should display in the tab itself? +label = "Channels" + +; Should we include the channels search control in the tab? +include_channels_search_box = false + ; This section controls which providers are used for Solr searches/records. ; Providers may be followed by a colon and the name of a configuration section ; to use. If no configuration section is provided, the default of diff --git a/module/VuFind/src/VuFind/RecordTab/Channels.php b/module/VuFind/src/VuFind/RecordTab/Channels.php index 68e462cc721..fa33f6c2de8 100644 --- a/module/VuFind/src/VuFind/RecordTab/Channels.php +++ b/module/VuFind/src/VuFind/RecordTab/Channels.php @@ -42,12 +42,20 @@ */ class Channels extends AbstractBase { + /** + * Config sections in channels.ini to use for loading channel settings. + * + * @var array + */ + protected array $configSections = ['recordTab', 'record']; + /** * Constructor * - * @param ChannelLoader $loader Channel loader + * @param ChannelLoader $loader Channel loader + * @param array $options Config settings */ - public function __construct(protected ChannelLoader $loader) + public function __construct(protected ChannelLoader $loader, protected array $options = []) { } @@ -58,7 +66,7 @@ public function __construct(protected ChannelLoader $loader) */ public function getDescription() { - return 'Channels'; + return $this->options['label'] ?? 'Channels'; } /** @@ -82,12 +90,13 @@ public function getContext() $request = $this->getRequest() ?: null; $query = $request?->getQuery(); $driver = $this->getRecordDriver(); - return $this->loader->getRecordContext( + $context = ['displaySearchBox' => $this->options['include_channels_search_box'] ?? false]; + return $context + $this->loader->getRecordContext( $driver->getUniqueID(), $query?->get('channelToken'), $query?->get('channelProvider'), $driver->getSearchBackendIdentifier(), - ['recordTab', 'record'] + $this->configSections ); } } diff --git a/module/VuFind/src/VuFind/RecordTab/ChannelsFactory.php b/module/VuFind/src/VuFind/RecordTab/ChannelsFactory.php index e738b10cd37..025a4e4d904 100644 --- a/module/VuFind/src/VuFind/RecordTab/ChannelsFactory.php +++ b/module/VuFind/src/VuFind/RecordTab/ChannelsFactory.php @@ -70,6 +70,7 @@ public function __invoke( if (!empty($options)) { throw new \Exception('Unexpected options passed to factory.'); } - return new $requestedName($container->get(ChannelLoader::class)); + $config = $container->get(\VuFind\Config\PluginManager::class)->get('channels')->toArray(); + return new $requestedName($container->get(ChannelLoader::class), $config['RecordTab'] ?? []); } } diff --git a/themes/bootstrap3/templates/channels/channelList.phtml b/themes/bootstrap3/templates/channels/channelList.phtml index 4f7cc2653ab..3ee440ae42a 100644 --- a/themes/bootstrap3/templates/channels/channelList.phtml +++ b/themes/bootstrap3/templates/channels/channelList.phtml @@ -23,7 +23,7 @@ } ?> - +