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

Add option to disable particle items #2509

Open
wants to merge 7 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
14 changes: 8 additions & 6 deletions engines/common/nucleus/particles/social.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
{% if particle.title %}<h2 class="g-title">{{ particle.title|raw }}</h2>{% endif %}
<div class="g-social {{ particle.css.class }}">
{% for item in particle.items %}
{% set title = (item.title is not empty) ? item.title|e : item.text|e %}
{% set titleAttrib = (title is not empty) ? ' title="' ~ title ~ '" aria-label="' ~ title ~ '"' : '' %}
<a href="{{ item.link|e }}"{{ targetAttrib|raw }}{{ titleAttrib|raw }}>
{% if particle.display in ['both', 'icons_only'] %}<span class="{{ item.icon|e }}"></span>{% endif %}
{% if particle.display in ['both', 'text_only'] %}<span class="g-social-text">{{ item.text|e }}</span>{% endif %}
</a>
{% if item.enabled|default(true) %}
{% set title = (item.title is not empty) ? item.title|e : item.text|e %}
{% set titleAttrib = (title is not empty) ? ' title="' ~ title ~ '" aria-label="' ~ title ~ '"' : '' %}
<a href="{{ item.link|e }}"{{ targetAttrib|raw }}{{ titleAttrib|raw }}>
{% if particle.display in ['both', 'icons_only'] %}<span class="{{ item.icon|e }}"></span>{% endif %}
{% if particle.display in ['both', 'text_only'] %}<span class="g-social-text">{{ item.text|e }}</span>{% endif %}
</a>
{% endif %}
{% endfor %}
</div>
{% endblock %}
6 changes: 6 additions & 0 deletions engines/common/nucleus/particles/social.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,12 @@ form:
ajax: true

fields:
.enabled:
type: enable.enable
label: Enabled
description: Enables the item on the front end.
default: true

.name:
type: input.text
label: Name
Expand Down
74 changes: 38 additions & 36 deletions themes/helium/common/particles/contentcubes.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -9,51 +9,53 @@
<div class="cube-items-wrapper">

{% for item in particle.items %}
<div class="item image-position-{{ item.imageposition }} cube-row g-grid">
<div class="g-block size-50">
{% if item.image %}
<div class="cube-image-wrapper">
<img src="{{ url(item.image)|e }}" alt="{{ item.title|e }}" class="cube-image" />
</div>
{% endif %}
</div>

<div class="g-block size-50">
<div class="cube-content-wrapper">
{% if item.label %}
<div class="item-label">{{ item.label|e }}</div>
{% if item.enabled|default(true) %}
<div class="item image-position-{{ item.imageposition }} cube-row g-grid">
<div class="g-block size-50">
{% if item.image %}
<div class="cube-image-wrapper">
<img src="{{ url(item.image)|e }}" alt="{{ item.title|e }}" class="cube-image" />
</div>
{% endif %}
</div>

<div class="item-title">
{% if item.link %}
<a target="{{ item.buttontarget|default('_self')|e }}" class="item-link {{ item.buttonclass|e }}" href="{{ item.link|e }}">
{% endif %}

{{ item.title|e }}

{% if item.link %}
<span class="item-link-text">{{ item.linktext|raw }}</span>
</a>
<div class="g-block size-50">
<div class="cube-content-wrapper">
{% if item.label %}
<div class="item-label">{{ item.label|e }}</div>
{% endif %}
</div>

{% if item.tags %}
<div class="item-tags">
<div class="item-title">
{% if item.link %}
<a target="{{ item.buttontarget|default('_self')|e }}" class="item-link {{ item.buttonclass|e }}" href="{{ item.link|e }}">
{% endif %}

{% for tag in item.tags %}
<span class="tag">
<a target="{{ tag.target|default('_self')|e }}" href="{{ tag.link|e }}">
{% if tag.icon %}<i class="{{ tag.icon }}"></i> {% endif %}
{{ tag.text|raw }}
</a>
</span>
{% endfor %}
{{ item.title|e }}

{% if item.link %}
<span class="item-link-text">{{ item.linktext|raw }}</span>
</a>
{% endif %}
</div>
{% endif %}

{% if item.tags %}
<div class="item-tags">

{% for tag in item.tags %}
<span class="tag">
<a target="{{ tag.target|default('_self')|e }}" href="{{ tag.link|e }}">
{% if tag.icon %}<i class="{{ tag.icon }}"></i> {% endif %}
{{ tag.text|raw }}
</a>
</span>
{% endfor %}

</div>
{% endif %}
</div>
</div>
</div>
</div>
{% endif %}
{% endfor %}

</div>
Expand Down
5 changes: 5 additions & 0 deletions themes/helium/common/particles/contentcubes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ form:
ajax: true

fields:
.enabled:
type: enable.enable
label: Enabled
description: Enables the item on the front end.
default: true
.name:
type: input.text
.image:
Expand Down
30 changes: 17 additions & 13 deletions themes/helium/common/particles/contenttabs.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@
<ul class="g-contenttabs-tab-wrapper-container">

{% for item in particle.items %}
<li class="g-contenttabs-tab-wrapper">
<span class="g-contenttabs-tab-wrapper-head">
<a class="g-contenttabs-tab" href="#g-contenttabs-item-{{ id }}-{{ loop.index }}">
<span class="g-contenttabs-tab-title">{{ item.title|raw }}</span>
</a>
</span>
</li>
{% if item.enabled|default(true) %}
<li class="g-contenttabs-tab-wrapper">
<span class="g-contenttabs-tab-wrapper-head">
<a class="g-contenttabs-tab" href="#g-contenttabs-item-{{ id }}-{{ loop.index }}">
<span class="g-contenttabs-tab-title">{{ item.title|raw }}</span>
</a>
</span>
</li>
{% endif %}
{% endfor %}

</ul>
Expand All @@ -26,13 +28,15 @@
<ul class="g-contenttabs-content-wrapper-container">

{% for item in particle.items %}
<li class="g-contenttabs-tab-wrapper">
<div class="g-contenttabs-tab-wrapper-body">
<div id="g-contenttabs-item-{{ id }}-{{ loop.index }}" class="g-contenttabs-content">
{{ item.content|raw }}
{% if item.enabled|default(true) %}
<li class="g-contenttabs-tab-wrapper">
<div class="g-contenttabs-tab-wrapper-body">
<div id="g-contenttabs-item-{{ id }}-{{ loop.index }}" class="g-contenttabs-content">
{{ item.content|raw }}
</div>
</div>
</div>
</li>
</li>
{% endif %}
{% endfor %}

</ul>
Expand Down
5 changes: 5 additions & 0 deletions themes/helium/common/particles/contenttabs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ form:
ajax: true

fields:
.enabled:
type: enable.enable
label: Enabled
description: Enables the item on the front end.
default: true
.title:
type: input.text
label: Title
Expand Down
8 changes: 5 additions & 3 deletions themes/helium/common/particles/horizontalmenu.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
<ul class="g-horizontalmenu {{ particle.class|e }}">

{% for item in particle.items %}
<li>
<a target="{{ particle.target }}" href="{{ item.link|e }}" title="{{ item.text }}">{{ item.text }}</a>
</li>
{% if item.enabled|default(true) %}
<li>
<a target="{{ particle.target }}" href="{{ item.link|e }}" title="{{ item.text }}">{{ item.text }}</a>
</li>
{% endif %}
{% endfor %}

</ul>
Expand Down
5 changes: 5 additions & 0 deletions themes/helium/common/particles/horizontalmenu.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ form:
ajax: true

fields:
.enabled:
type: enable.enable
label: Enabled
description: Enables the item on the front end.
default: true
.name:
type: input.text
label: Name
Expand Down
18 changes: 10 additions & 8 deletions themes/hydrogen/common/particles/sample.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@
</div>
<div class="g-grid">
{% for sample in particle.samples %}
<div {% if sample.id %}id="{{ sample.id|e }}"{% endif %}
class="g-block {{ sample.class }} {{ sample.variations }}">
<div class="g-content">
<i class="{{ sample.icon }} sample-icons"></i>
<h4>{{ sample.title|raw }}</h4>
{{ sample.subtitle|raw }}
{{ sample.description|raw }}
{% if item.enabled|default(true) %}
<div {% if sample.id %}id="{{ sample.id|e }}"{% endif %}
class="g-block {{ sample.class }} {{ sample.variations }}">
<div class="g-content">
<i class="{{ sample.icon }} sample-icons"></i>
<h4>{{ sample.title|raw }}</h4>
{{ sample.subtitle|raw }}
{{ sample.description|raw }}
</div>
</div>
</div>
{% endif %}
{% endfor %}
</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions themes/hydrogen/common/particles/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ form:
overridable: false

fields:
.enabled:
type: enable.enable
label: Enabled
description: Enables the item on the front end.
default: true

.icon:
type: input.icon
label: Icon
Expand Down