Skip to content

Commit

Permalink
Make loan type display configurable.
Browse files Browse the repository at this point in the history
  • Loading branch information
bbusenius committed Jan 15, 2025
1 parent 7dfa676 commit 0284356
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions config/vufind/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,9 @@ title_level_holds_mode = "disabled"
; can extend/override the VuFind\View\Helper\Root\Holdings::holdingIsVisible method.
;display_items_without_barcodes = true

; Whether to display the loan type on items in the Holdings display.
;display_loan_type_in_holdings = true

; This section controls features related to user accounts
[Account]
; Allow the user to set a home library through the Profile screen, which will
Expand Down
11 changes: 11 additions & 0 deletions module/VuFind/src/VuFind/View/Helper/Root/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,15 @@ public function dateTimeFormat($separator = ' '): string
{
return $this->dateFormat() . $separator . $this->timeFormat();
}

/**
* Check if the loan type should be displayed in holdings
*
* @return bool
*/
public function displayLoanType(): bool
{
return (bool)($this->get('config')->Catalog
->display_loan_type_in_holdings ?? false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</span>
<?php if ($availabilityStatus->isAvailable()): ?>
<?php /* Begin Available Items (Holds) */ ?>
<?php if (!empty($holding['loan_type_name'])): ?>
<?php if ($this->config()->displayLoanType() ?? false && !empty($holding['loan_type_name'])): ?>
<span class="loan-type"><?=$this->transEsc('Loan Type')?>: <?=$holding['loan_type_name']?>&nbsp;</span>
<?php endif; ?>
<?php if ($holding['link'] ?? false): ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
</span>
<?php if ($availabilityStatus->isAvailable()): ?>
<?php /* Begin Available Items (Holds) */ ?>
<?php if (!empty($holding['loan_type_name'])): ?>
<?php if ($this->config()->displayLoanType() ?? false && !empty($holding['loan_type_name'])): ?>
<span class="loan-type"><?=$this->transEsc('Loan Type')?>: <?=$holding['loan_type_name']?>&nbsp;</span>
<?php endif; ?>
<?php if ($holding['link'] ?? false): ?>
Expand Down

0 comments on commit 0284356

Please sign in to comment.