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

Added planned / timed slides to owlcarousel #2441

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 16 additions & 1 deletion themes/helium/common/particles/owlcarousel.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,22 @@
<div id="g-owlcarousel-{{ id }}" class="g-owlcarousel owl-carousel {% if particle.imageOverlay == 'enable' %}has-color-overlay{% endif %}">

{% for item in particle.items %}
{% if not item.disable %}
{% set showItem = item.showItem|default('yes') %}
{% if showItem != 'yes' and showItem != 'no' %}
{% set format = (showItem == 'once') ? 'Y-m-d' : 'm-d' %}
{% set start, now, end = item.startDate|date(format), "now"|date(format), item.endDate|date(format) %}
{% if showItem == 'once' %}
{% if start <= now and end >= now %}
{% set showItem = 'yes' %}
{% endif %}
{% elseif showItem == 'annual' %}
{% if (start <= end and start <= now and end >= now) or
(start > end and (start <= now or end >= now)) %}
{% set showItem = 'yes' %}
{% endif %}
{% endif %}
{% endif %}
{% if showItem == 'yes' %}
<div class="g-owlcarousel-item {{ item.class|e }}">
<div class="g-owlcarousel-item-wrapper">
<div class="g-owlcarousel-item-img">
Expand Down
27 changes: 18 additions & 9 deletions themes/helium/common/particles/owlcarousel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@ description: Display Owl Carousel.
type: particle
icon: fa-sliders

configuration:
caching:
type: static

form:
fields:
enabled:
Expand Down Expand Up @@ -109,8 +105,21 @@ form:
label: Button Class
description: Input the button class.
default: 'button-outline'
.disable:
type: input.checkbox
label: Disable
description: Disables the item on the front end.
default: false
.showItem:
type: select.select
label: Show Item
description: Select the front end rendering behaviour for the item.
default: yes
options:
yes: Yes
no: No
once: Once
annual: Annual
.startDate:
type: input.date
label: Start Date
description: Select the date when the item should be first shown (only for 'annual' and 'once').
.endDate:
type: input.date
label: End Date
description: Select the date when the item should be last shown (only for 'annual' and 'once').