Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[TwigBridge] [Bootstrap 4] Fix hidden errors #24802

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

Merged
merged 1 commit into from
Nov 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,54 @@

{# Widgets #}

{% block money_widget -%}
{% if not valid %}
{% set group_class = ' form-control is-invalid' %}
{% set valid = true %}
{% endif %}
{{- parent() -}}
{%- endblock money_widget %}

{% block datetime_widget -%}
{%- if widget != 'single_text' and not valid -%}
{% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control is-invalid')|trim}) -%}
{% set valid = true %}
{%- endif -%}
{{- parent() -}}
{%- endblock datetime_widget %}

{% block date_widget -%}
{%- if widget != 'single_text' and not valid -%}
{% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control is-invalid')|trim}) -%}
{% set valid = true %}
{%- endif -%}
{{- parent() -}}
{%- endblock date_widget %}

{% block time_widget -%}
{%- if widget != 'single_text' and not valid -%}
{% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control is-invalid')|trim}) -%}
{% set valid = true %}
{%- endif -%}
{{- parent() -}}
{%- endblock time_widget %}

{% block dateinterval_widget -%}
{%- if widget != 'single_text' and not valid -%}
{% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control is-invalid')|trim}) -%}
{% set valid = true %}
{%- endif -%}
{{- parent() -}}
{%- endblock dateinterval_widget %}

{% block percent_widget -%}
<div class="input-group{{ not valid ? ' form-control is-invalid' }}">
{% set valid = true %}
{{- block('form_widget_simple') -}}
<span class="input-group-addon">%</span>
</div>
{%- endblock percent_widget %}

{% block form_widget_simple -%}
{% if type is not defined or type != 'hidden' %}
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control' ~ (type|default('') == 'file' ? '-file' : ''))|trim}) -%}
Expand All @@ -11,7 +59,7 @@

{%- block widget_attributes -%}
{%- if not valid %}
{% set attr = attr|merge({class: (attr.class|default('') ~ ' is-invalid')|trim}) %}
{% set attr = attr|merge({class: (attr.class|default('') ~ ' form-control is-invalid')|trim}) %}
{% endif -%}
{{ parent() }}
{%- endblock widget_attributes -%}
Expand All @@ -27,7 +75,7 @@
{% if 'checkbox-inline' in parent_label_class %}
{{- form_label(form, null, { widget: parent() }) -}}
{% else -%}
<div class="form-check">
<div class="form-check{{ not valid ? ' form-control is-invalid' }}">
{{- form_label(form, null, { widget: parent() }) -}}
</div>
{%- endif -%}
Expand All @@ -39,7 +87,7 @@
{%- if 'radio-inline' in parent_label_class -%}
{{- form_label(form, null, { widget: parent() }) -}}
{%- else -%}
<div class="form-check">
<div class="form-check{{ not valid ? ' form-control is-invalid' }}">
{{- form_label(form, null, { widget: parent() }) -}}
</div>
{%- endif -%}
Expand All @@ -55,6 +103,9 @@
}) -}}
{% endfor -%}
{%- else -%}
{%- if not valid -%}
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' form-control is-invalid')|trim}) %}
{%- endif -%}
<div {{ block('widget_container_attributes') }}>
{%- for child in form %}
{{- form_widget(child, {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{%- endblock textarea_widget %}

{% block money_widget -%}
<div class="input-group">
<div class="input-group{{ group_class|default('') }}">
{%- set append = money_pattern starts with '{{' -%}
{%- if not append -%}
<span class="input-group-addon">{{ money_pattern|replace({ '{{ widget }}':''}) }}</span>
Expand Down