Skip to content

Commit

Permalink
new: option to configure "See more" text and text length
Browse files Browse the repository at this point in the history
  • Loading branch information
sal0max committed May 4, 2022
1 parent e837b86 commit 2e7575d
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# v1.4.0
## 05/05/2022

1. [](#new)
* Option configure "See more" text and text length until "See more appears" for the lightbox.

# v1.3.0
## 05/04/2022

Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ Just have a look for yourself:
| `draggable` | `true`, `false` | Enable or disable mouse drag to go to previous and next slide.
| `descEnabled` | `true`, `false` | **For description, the title-text of an image is used: `![](image.jpg "description")`**
| `descPosition` | `bottom`, `top`, `left`, `right` | The position for slides description.
| `descMoreText` | text | Description: "See more" text.
| `descMoreLength` | number | Description: Characters until "See more". Will display the entire description, if set to `0`.


---
Expand Down
14 changes: 13 additions & 1 deletion blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Shortcode Gallery++
slug: shortcode-gallery-plusplus
type: plugin
version: 1.3.0
version: 1.4.0
description: A Shortcode extension to add sweet galleries with a lightbox to your Grav website.
icon: code
author:
Expand Down Expand Up @@ -192,3 +192,15 @@ form:
"left": "left"
"right": "right"
size: small
lightbox.descMoreText:
label: PLUGIN_SHORTCODE_GALLERY_PLUSPLUS.DEFAULT_DESC_MORE_TEXT
help: PLUGIN_SHORTCODE_GALLERY_PLUSPLUS.DEFAULT_DESC_MORE_TEXT_HELP
type: text
size: small
lightbox.descMoreLength:
label: PLUGIN_SHORTCODE_GALLERY_PLUSPLUS.DEFAULT_DESC_MORE_LENGTH
help: PLUGIN_SHORTCODE_GALLERY_PLUSPLUS.DEFAULT_DESC_MORE_LENGTH_HELP
type: number
validate:
min: 0
size: small
7 changes: 7 additions & 0 deletions languages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,10 @@ en:

DEFAULT_DESC_POSITION: "Description position"
DEFAULT_DESC_POSITION_HELP: "Position for slides description."

DEFAULT_DESC_MORE_TEXT: 'Description: "See more" text'
DEFAULT_DESC_MORE_TEXT_HELP: "The text which indicates there is more description text. Used on small layout (mobile devices)."

DEFAULT_DESC_MORE_LENGTH: 'Description: Characters until "See more"'
DEFAULT_DESC_MORE_LENGTH_HELP: "Number of characters to display on the description before adding the 'See more' link. If set to 0 it will display the entire description."

2 changes: 2 additions & 0 deletions shortcode-gallery-plusplus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ lightbox:
draggable: "true"
descEnabled: "false"
descPosition: bottom
descMoreText: "See more"
descMoreLength: 60
4 changes: 4 additions & 0 deletions shortcodes/GalleryPlusPlusShortcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ public function init()
$draggable = $shortcode->getParameter('draggable', $pluginConfig['lightbox']['draggable']);
$descEnabled = $shortcode->getParameter('descEnabled', $pluginConfig['lightbox']['descEnabled']);
$descPosition = $shortcode->getParameter('descPosition', $pluginConfig['lightbox']['descPosition']);
$descMoreText = $shortcode->getParameter('descMoreText', $pluginConfig['lightbox']['descMoreText']);
$descMoreLength = $shortcode->getParameter('descMoreLength', $pluginConfig['lightbox']['descMoreLength']);

// find all images, that a gallery contains
$content = $shortcode->getContent();
Expand Down Expand Up @@ -143,6 +145,8 @@ public function init()
'draggable' => $draggable,
'descEnabled' => $descEnabled,
'descPosition' => $descPosition,
'descMoreText' => $descMoreText,
'descMoreLength' => $descMoreLength,
// images
'images' => $images_final,
]);
Expand Down
2 changes: 2 additions & 0 deletions templates/partials/gallery-plusplus.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,6 @@ GLightbox({
loop: {{ loop }},
draggable: {{ draggable }},
descPosition: "{{ descPosition }}",
moreText: "{{ descMoreText }}",
moreLength: {{ descMoreLength }},
});</script>

0 comments on commit 2e7575d

Please sign in to comment.