Skip to content

Commit 4a7ee56

Browse files
author
Petter Walbø Johnsgård
authored
Add filter to hide expand icon and more images link (#21)
1 parent 26776e7 commit 4a7ee56

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ Install the module using Composer `composer require dekodeinteraktiv/hogan-galle
55

66
## Available filters
77
- `hogan/module/gallery/layout/grid/thumbnail_size` for overriding default thumbnail image size for grid layout, default 'thumbnail'.
8+
- `hogan/module/gallery/layout/grid/show_more_link` Show "+ X images" link if more than 6 images in grid layout. Default `true`
9+
- `hogan/module/gallery/layout/slider/show_expand_icon` Show icon to open expand the icon. If false you can click on the image instead. Default `true`.
810
- `hogan/module/gallery/layout/thumbnail_size` for overriding default thumbnail image size for other layouts than grid, default 'large'.
911
- `hogan/module/gallery/template` for overriding the default template file.
1012
- `hogan/module/gallery/wrapper_tag` for outer HTML wrapper tag, default `<section>`

assets/template.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727

2828
$image_size = 'grid' === $this->layout ? apply_filters( 'hogan/module/gallery/layout/grid/thumbnail_size', 'thumbnail' ) : apply_filters( 'hogan/module/gallery/layout/thumbnail_size', 'large' );
2929

30+
$show_slider_icon = apply_filters( 'hogan/module/gallery/layout/slider/show_expand_icon', true );
31+
$show_more_link = apply_filters( 'hogan/module/gallery/layout/grid/show_more_link', true );
32+
3033
?>
3134
<div class="<?php echo esc_attr( $classnames ); ?>" itemscope itemtype="http://schema.org/ImageGallery" data-pswp-uid="<?php echo esc_attr( $this->counter ); ?>">
3235
<?php
@@ -53,7 +56,7 @@ class="<?php echo esc_attr( $classnames ); ?>"
5356
);
5457

5558
// If slider we only want a link in the top corner. Close the link before image.
56-
if ( $is_slider ) {
59+
if ( $is_slider && $show_slider_icon ) {
5760
echo '<svg viewBox="0 0 100 100" class="hogan-gallery-expand-icon"><path d="M90.9 84.5L56.4 50l34.5-34.5v17.8h9.1V0H66.7v9.1h17.8L50 43.6 15.5 9.1h17.8V0H0v33.3h9.1V15.5L43.6 50 9.1 84.5V66.7H0V100h33.3v-9.1H15.5L50 56.4l34.5 34.5H66.7v9.1H100V66.7h-9.1z"></path></svg>';
5861
echo '</a>';
5962
}
@@ -66,7 +69,7 @@ class="<?php echo esc_attr( $classnames ); ?>"
6669
);
6770

6871
// Close link (slider is already closed).
69-
if ( ! $is_slider ) {
72+
if ( ! $is_slider || ! $show_slider_icon ) {
7073
echo '</a>';
7174
}
7275

@@ -86,7 +89,7 @@ class="<?php echo esc_attr( $classnames ); ?>"
8689
$index++;
8790
endforeach;
8891

89-
if ( $index > 6 && $is_masonry ) {
92+
if ( $show_more_link && $index > 6 && $is_masonry ) {
9093
$additional_images_count = $index - 6;
9194

9295
printf( '<div class="hogan-gallery-more">%s</div>',

0 commit comments

Comments
 (0)