Skip to content

Commit

Permalink
Merge pull request #1707 from bolt/bobdenotter-patch-1
Browse files Browse the repository at this point in the history
Fix 'custom' Fields showing up with their Label, if `_fields.twig` is used.
  • Loading branch information
I-Valchev committed Aug 12, 2020
2 parents eb7a628 + a81a8d2 commit 7cc2738
Showing 1 changed file with 8 additions and 22 deletions.
30 changes: 8 additions & 22 deletions templates/helpers/_field_blocks.twig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{# Sub-block for 'text' field such as 'text', 'textarea', or 'html' #}
{# Sub-block for 'text' field such as 'text', 'textarea', 'html' or 'markdown' #}
{% block text_field %}
<div data-bolt-field="{{ field.name }}">
<{{ tag }}>
Expand All @@ -9,27 +9,15 @@
</div>
{% endblock %}

{# Sub-block for Markdown fields #}
{% block markdown_field %}
<div data-bolt-field="{{ field.name }}">
{{ field.twigValue() }}
</div>
{% endblock %}

{# Block for "basic" fields like HTML, Markdown, Textarea and Text #}
{% block common_fields %}

{# HTML, Textarea, Text fields #}
{% if type in ['html', 'textarea', 'text'] %}
{# HTML, Textarea, Text and Markdown fields #}
{% if type in ['html', 'textarea', 'text', 'markdown'] %}
{% set tag = (field.name in ['title', 'name', 'caption', 'subject', 'heading']) ? 'h3' : 'p' %}
{{ block('text_field') }}
{% endif %}

{# Markdown fields #}
{% if type == 'markdown' %}
{{ block('markdown_field') }}
{% endif %}

{# Image fields #}
{% if type == "image" and field.filename is not empty %}
{{ field|showimage('684') }}
Expand Down Expand Up @@ -84,13 +72,11 @@
{# No special cases defined for other fieldtypes. We just output them if
they're a simple scalar, and 'dump' them otherwise. #}
{% if type not in allfields and field is not empty %}
<p><strong>{{ field|label }}: </strong>
{% if field is iterable %}
{{ dump(field) }}
{% else %}
{{ field.twigValue() }}
{% endif %}
</p>
{% if field is iterable %}
{{ dump(field) }}
{% else %}
{{ field.twigValue() }}
{% endif %}
{% endif %}

{% endblock %}

0 comments on commit 7cc2738

Please sign in to comment.