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

Fixed typo in classes and outerclasses and added outerclasses to column and section fields. New div block for field.outerclasses. New headgin_classes tag for h1 tag #2424

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
10 changes: 9 additions & 1 deletion themes/grav/templates/forms/field.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@

{# DEPRECATED: Needed by old form fields; remove when backwards compatibility breaks are allowed #}
{% set isDisabledToggleable = toggleable and not toggleableChecked %}
{# Backwards compatibility with field.outer_classes instead of field.outerclasses #}
{% set outerclasses = field.outerclasses ?? field.outer_classes %}

{% block field %}
<div class="form-field grid{% if vertical %} vertical{% endif %}{% if toggleable %} form-field-toggleable{% endif %} {{ field.outerclasses }} {{ field.field_classes }}">
{% if outerclasses %}
<div class="{{ outerclasses }}">
{% endif %}
<div class="form-field grid{% if vertical %} vertical{% endif %}{% if toggleable %} form-field-toggleable{% endif %} {{ field.classes }}">
{% block contents %}
{% if show_label %}
<div class="form-label{% if not vertical %} block size-1-3{% endif %}">
Expand Down Expand Up @@ -125,6 +130,9 @@
</div>
{% endblock %}
</div>
{% if outerclasses %}
</div>
{% endif %}
{% endblock %}

{% endif %}
8 changes: 0 additions & 8 deletions themes/grav/templates/forms/fields/column/column.html.twig

This file was deleted.

17 changes: 13 additions & 4 deletions themes/grav/templates/forms/fields/section/section.html.twig
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
{% extends "forms/field.html.twig" %}

{% block field %}
{# Backwards compatibility with field.outer_classes instead of field.outerclasses #}
{% set outerclasses = field.outerclasses ?? field.outer_classes %}

{% if field.security is empty or authorize(array(field.security)) %}

{% if outerclasses %}
<div class="{{ outerclasses }}">
{% endif %}

{% if field.title or field.underline %}
<h1 class="{{ field.classes }} {{ field.underline ?: 'no_underline' }}">{{ field.title|t }}</h1>
<h2 class="{{ field.heading_classes }} {{ field.underline ?: 'no_underline' }}">{{ field.title|t }}</h2>
{% endif %}

{% if field.text %}
<p>{{ field.text|t|markdown|raw }}</p>
{{ field.text|t|markdown|raw }}
{% endif %}

{% embed 'forms/default/fields.html.twig' with {name: field.name, fields: field.fields} %}
{% block outer_markup_field_open %}
<div class="form-section {{ field.field_classes }} {{ field.outer_classes }}">
<div class="form-section {{ field.classes }}">
{% endblock %}
{% block outer_markup_field_close %}
</div>
{% endblock %}
{% endembed %}

{% if outerclasses %}
</div>
{% endif %}
{% endif %}
{% endblock %}