Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use null coalescing to simplify combined search templates. #3118

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions themes/bootstrap3/templates/combined/results-list.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
? $this->url($advancedSearchAction, [], ['query' => ['edit' => $results->getSearchId()]])
: false;
?>
<?php if (isset($currentSearch['more_link']) && $currentSearch['more_link']): ?>
<?php if ($currentSearch['more_link'] ?? false): ?>
<div class="pull-right flip">
<a href="<?=$moreUrl?>" class="btn btn-link icon-link">
<?=$this->icon('options', 'icon-link__icon') ?>
Expand Down Expand Up @@ -85,7 +85,7 @@
];
?>
<?=$this->render('search/list-' . $viewType . '.phtml', $viewParams)?>
<?php if (isset($currentSearch['more_link']) && $currentSearch['more_link']): ?>
<?php if ($currentSearch['more_link'] ?? false): ?>
<p class="more_link_bottom">
<a class="icon-link" href="<?=$moreUrl?>">
<span class="icon-link__label"><?=$this->transEsc($currentSearch['more_link'])?></span>
Expand Down
8 changes: 4 additions & 4 deletions themes/bootstrap3/templates/combined/stack-distributed.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<?php foreach ($this->combinedResults as $searchClassId => $currentSearch): ?>
<?php
if (
(!isset($currentSearch['ajax']) || !$currentSearch['ajax']) // AJAX column
&& (isset($currentSearch['hide_if_empty']) && $currentSearch['hide_if_empty']) // set to hide when empty
&& $currentSearch['view']->results->getResultTotal() == 0 // and empty
!($currentSearch['ajax'] ?? false) // AJAX column
&& ($currentSearch['hide_if_empty'] ?? false) // set to hide when empty
&& $currentSearch['view']->results->getResultTotal() == 0 // and empty
) {
continue;
}
Expand Down Expand Up @@ -36,7 +36,7 @@
<div class="combined-column">
<?php foreach ($currColumn as $colParams): ?>
<div id="<?=$this->escapeHtmlAttr($colParams['domId'])?>" class="combined-list">
<?php $templateSuffix = (isset($colParams['ajax']) && $colParams['ajax']) ? 'ajax' : 'list'; ?>
<?php $templateSuffix = ($colParams['ajax'] ?? false) ? 'ajax' : 'list'; ?>
<?=$this->render('combined/results-' . $templateSuffix . '.phtml', $colParams)?>
</div>
<?php endforeach; ?>
Expand Down
10 changes: 5 additions & 5 deletions themes/bootstrap3/templates/combined/stack-left.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
?>
<?php
if (
(!isset($currentSearch['ajax']) || !$currentSearch['ajax']) // AJAX column
&& (isset($currentSearch['hide_if_empty']) && $currentSearch['hide_if_empty']) // set to hide when empty
&& $currentSearch['view']->results->getResultTotal() == 0 // and empty
!($currentSearch['ajax'] ?? false) // AJAX column
&& ($currentSearch['hide_if_empty'] ?? false) // set to hide when empty
&& $currentSearch['view']->results->getResultTotal() == 0 // and empty
) {
continue;
}
Expand All @@ -34,15 +34,15 @@
}
?>
<div id="<?=$this->escapeHtmlAttr($currentSearch['domId'])?>" class="combined-list">
<?php $templateSuffix = (isset($currentSearch['ajax']) && $currentSearch['ajax']) ? 'ajax' : 'list'; ?>
<?php $templateSuffix = ($currentSearch['ajax'] ?? false) ? 'ajax' : 'list'; ?>
<?=$this->render('combined/results-' . $templateSuffix . '.phtml', $viewParams)?>
</div>
<?php endforeach; ?>
</div>
<?php foreach ($rightColumns as $colParams): ?>
<div class="combined-column">
<div id="<?=$this->escapeHtmlAttr($colParams['domId'])?>" class="combined-list">
<?php $templateSuffix = (isset($colParams['ajax']) && $colParams['ajax']) ? 'ajax' : 'list'; ?>
<?php $templateSuffix = ($colParams['ajax'] ?? false) ? 'ajax' : 'list'; ?>
<?=$this->render('combined/results-' . $templateSuffix . '.phtml', $colParams)?>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions themes/bootstrap3/templates/combined/stack-right.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
?>
<?php
if (
(!isset($currentSearch['ajax']) || !$currentSearch['ajax']) // AJAX column
&& (isset($currentSearch['hide_if_empty']) && $currentSearch['hide_if_empty']) // set to hide when empty
&& $currentSearch['view']->results->getResultTotal() == 0 // and empty
!($currentSearch['ajax'] ?? false) // AJAX column
&& ($currentSearch['hide_if_empty'] ?? false) // set to hide when empty
&& $currentSearch['view']->results->getResultTotal() == 0 // and empty
) {
continue;
}
?>
<div id="<?=$this->escapeHtmlAttr($currentSearch['domId'])?>" class="combined-list">
<?php $templateSuffix = (isset($currentSearch['ajax']) && $currentSearch['ajax']) ? 'ajax' : 'list'; ?>
<?php $templateSuffix = ($currentSearch['ajax'] ?? false) ? 'ajax' : 'list'; ?>
<?=$this->render('combined/results-' . $templateSuffix . '.phtml', $viewParams)?>
</div>
<?php $columnIndex ++; ?>
Expand Down