update main branch #47

Merged
jorge merged 166 commits from develop into main 2021-12-01 11:20:13 +01:00
1 changed files with 53 additions and 0 deletions
Showing only changes of commit 18e6f3392d - Show all commits

View File

@ -0,0 +1,53 @@
<?php
$translate = $this->plugin('translate');
$hyperlink = $this->plugin('hyperlink');
$url = $this->plugin('url');
$this->htmlElement('body')->appendAttribute('class', 'index search');
?>
<?php echo $this->pageTitle(sprintf($translate('Search results for “%s”'), $query)); ?>
<?php if (empty($results)): ?>
<p><?php echo $translate('No result found'); ?></p>
<?php else: ?>
<?php
$resourceLabels = [
'site_pages' => 'Site pages', // @translate
'items' => 'Items', // @translate
'item_sets' => 'Item sets', // @translate
'media' => 'Media', // @translate
];
$resourceControllers = [
'site_pages' => 'page',
'items' => 'item',
'item_sets' => 'item-set',
'media' => 'media',
];
?>
<?php foreach ($results as $resourceName => $result): ?>
<div class="<?php echo $resourceName; ?> results">
<h2><?php echo $translate($resourceLabels[$resourceName]); ?></h2>
<?php $titleMethod = $resourceName === 'site_pages' ? 'title' : 'displayTitle'; ?>
<ul>
<?php foreach ($result['resources'] as $resource): ?>
<li>
<?php echo $resource->link($resource->$titleMethod()); ?>
</li>
<?php endforeach; ?>
</ul>
<!-- removes 'view all results' from site search -->
<!--
<?php echo $hyperlink(
sprintf($translate('View all results (%s total)'), $result['total']),
$url(
'site/resource',
['controller' => $resourceControllers[$resourceName], 'action' => 'browse'],
['query' => ['fulltext_search' => $query]],
true
)
); ?>
-->
</div>
<?php endforeach; ?>
<?php endif; ?>