Skip to content

Commit

Permalink
Apply hide thumbnails setting to all browses, add title attribute. (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
kimisgold committed Mar 22, 2021
1 parent 1c30522 commit 982149c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
10 changes: 8 additions & 2 deletions collections/browse.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
$layout = (get_theme_option('item_browse_layout') !== null) ? get_theme_option('item_browse_layout') : 'list';
$hideThumbnails = (get_theme_option('browse_hide_thumbnails') == 1);
$gridState = ($layout == 'togglegrid') ? 'disabled' : '';
$listState = ($layout == 'togglelist') ? 'disabled': '';
$isGrid = (!isset($layout) || strpos($layout, 'grid') !== false) ? true : false;
Expand Down Expand Up @@ -46,13 +47,18 @@
<?php foreach (loop('collections') as $collection): ?>

<li class="collection resource <?php echo ($isGrid) ? '' : 'media-object'; ?>">
<?php if ($collectionImage = record_image('collection')): ?>
<?php if (($collectionImage = record_image('collection')) && !$hideThumbnails): ?>
<div class="resource-image <?php echo ($isGrid) ? '' : 'media-object-section'; ?>">
<?php echo link_to_collection($collectionImage, array('class' => 'thumbnail')); ?>
</div>
<?php endif; ?>
<div class="resource-meta <?php echo ($isGrid) ? '' : 'media-object-section'; ?>">
<h4><?php echo link_to_collection(); ?></h4>
<h4>
<?php echo link_to_collection(); ?>
<?php if ($hideThumbnails && isset($collectionImage)): ?>
<span class="has-media" aria-label="<?php echo __('Has media'); ?>" title="<?php echo __('Has media'); ?>"></span>
<?php endif; ?>
</h4>

<?php if (metadata('collection', array('Dublin Core', 'Description'))): ?>
<div class="collection-description">
Expand Down
11 changes: 9 additions & 2 deletions exhibit-builder/exhibits/browse.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
$layout = (get_theme_option('item_browse_layout') !== null) ? get_theme_option('item_browse_layout') : 'list';
$hideThumbnails = (get_theme_option('browse_hide_thumbnails') == 1);
$gridState = ($layout == 'togglegrid') ? 'disabled' : '';
$listState = ($layout == 'togglelist') ? 'disabled': '';
$isGrid = (!isset($layout) || strpos($layout, 'grid') !== false) ? true : false;
Expand Down Expand Up @@ -44,13 +45,19 @@
<ul class="resources <?php echo ($isGrid) ? 'resource-grid' : 'resource-list'; ?>">
<?php foreach (loop('exhibit') as $exhibit): ?>
<li class="exhibit resource <?php echo ($isGrid) ? '' : 'media-object'; ?>">
<?php if ($exhibitImage = record_image($exhibit)): ?>
<?php if (($exhibitImage = record_image($exhibit)) && !$hideThumbnails): ?>
<div class="resource-image <?php echo ($isGrid) ? '' : 'media-object-section'; ?>">
<?php echo exhibit_builder_link_to_exhibit($exhibit, $exhibitImage, array('class' => 'thumbnail')); ?>
</div>
<?php endif; ?>
<div class="resource-meta <?php echo ($isGrid) ? '' : 'media-object-section'; ?>">
<h4><?php echo link_to_exhibit(); ?></h4>
<h4>
<?php echo link_to_exhibit(); ?>
<?php if ($hideThumbnails && isset($exhibitImage)): ?>
<span class="has-media" aria-label="<?php echo __('Has media'); ?>" title="<?php echo __('Has media'); ?>"></span>
<?php endif; ?>
</h4>
</h4>
<?php if ($exhibitDescription = metadata('exhibit', 'description', array('no_escape' => true))): ?>
<div class="description <?php echo $truncateDescription; ?>"><?php echo $exhibitDescription; ?></div>
<?php endif; ?>
Expand Down
2 changes: 1 addition & 1 deletion items/browse.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<h4>
<?php echo link_to_item(metadata('item', array('Dublin Core', 'Title')), array('class' => 'permalink')); ?>
<?php if ($hideThumbnails && metadata('item', 'has files')): ?>
<span class="has-media" aria-label="<?php echo __('Has media'); ?>"></span>
<span class="has-media" aria-label="<?php echo __('Has media'); ?>" title="<?php echo __('Has media'); ?>"></span>
<?php endif; ?>
</h4>
<?php if ($description = metadata('item', array('Dublin Core', 'Description'))): ?>
Expand Down

0 comments on commit 982149c

Please sign in to comment.