Skip to content

Commit

Permalink
[FINNA-2940] Display CollectionList tab for records which are part of…
Browse files Browse the repository at this point in the history
… a collection (#3116)
  • Loading branch information
LuomaJuha authored Dec 20, 2024
1 parent e7aee1e commit e53866d
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
2 changes: 2 additions & 0 deletions module/Finna/config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,7 @@
'Finna\RecordTab\AuthorityRecordsAuthor' => 'Finna\RecordTab\AuthorityRecordsFactory',
'Finna\RecordTab\AuthorityRecordsTopic' => 'Finna\RecordTab\AuthorityRecordsFactory',
'Finna\RecordTab\CollectionHierarchyTree' => 'VuFind\RecordTab\CollectionHierarchyTreeFactory',
'Finna\RecordTab\CollectionList' => 'VuFind\RecordTab\CollectionListFactory',
'Finna\RecordTab\HoldingsArchive' => 'Finna\RecordTab\Factory::getHoldingsArchive',
'Finna\RecordTab\HierarchyTree' => 'VuFind\RecordTab\HierarchyTreeFactory',
'Finna\RecordTab\Map' => 'Finna\RecordTab\Factory::getMap',
Expand All @@ -1011,6 +1012,7 @@

// Overrides:
'VuFind\RecordTab\CollectionHierarchyTree' => 'Finna\RecordTab\CollectionHierarchyTree',
'VuFind\RecordTab\CollectionList' => 'Finna\RecordTab\CollectionList',
'VuFind\RecordTab\HierarchyTree' => 'Finna\RecordTab\HierarchyTree',
'VuFind\RecordTab\Map' => 'Finna\RecordTab\Map',
'VuFind\RecordTab\UserComments' => 'Finna\RecordTab\UserComments',
Expand Down
54 changes: 54 additions & 0 deletions module/Finna/src/Finna/RecordTab/CollectionList.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

/**
* Collection list tab
*
* PHP version 8
*
* Copyright (C) The National Library of Finland 2024.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category VuFind
* @package RecordTabs
* @author Juha Luoma <[email protected]>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development:plugins:record_tabs Wiki
*/

namespace Finna\RecordTab;

/**
* Collection list tab
*
* @category VuFind
* @package RecordTabs
* @author Juha Luoma <[email protected]>
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License
* @link https://vufind.org/wiki/development:plugins:record_tabs Wiki
*/
class CollectionList extends \VuFind\RecordTab\CollectionList
{
/**
* Is this tab active?
* Override to allow this tab to be displayed for records which are part of a collection.
*
* @return bool
*/
public function isActive()
{
$driver = $this->getRecordDriver();
return $driver->tryMethod('isCollection') || $driver->tryMethod('getContainingCollections');
}
}

0 comments on commit e53866d

Please sign in to comment.