Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e47a134

Browse filesBrowse files
Lyssalfabpot
authored andcommitted
[Twig][Form] Twig theme for Foundation 6
1 parent ae00ff4 commit e47a134
Copy full SHA for e47a134

File tree

2 files changed

+52
-0
lines changed
Filter options

2 files changed

+52
-0
lines changed

‎src/Symfony/Bridge/Twig/CHANGELOG.md

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/CHANGELOG.md
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ CHANGELOG
88
* removed `transChoice` filter and token
99
* `HttpFoundationExtension` requires a `UrlHelper` on instantiation
1010
* removed support for implicit STDIN usage in the `lint:twig` command, use `lint:twig -` (append a dash) instead to make it explicit.
11+
* added form theme for Foundation 6
12+
* added support for Foundation 6 switches: add the `switch-input` class to the attributes of a `CheckboxType`
1113

1214
4.4.0
1315
-----
+50Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{% extends "form_div_layout.html.twig" %}
2+
3+
{%- block checkbox_row -%}
4+
{%- set parent_class = parent_class|default(attr.class|default('')) -%}
5+
{%- if 'switch-input' in parent_class -%}
6+
{{- form_label(form) -}}
7+
{%- set attr = attr|merge({class: (attr.class|default('') ~ ' switch-input')|trim}) -%}
8+
{{- form_widget(form) -}}
9+
<label class="switch-paddle" for="{{ form.vars.id }}"></label>
10+
{{- form_errors(form) -}}
11+
{%- else -%}
12+
{{- block('form_row') -}}
13+
{%- endif -%}
14+
{%- endblock checkbox_row -%}
15+
16+
{% block money_widget -%}
17+
{% set prepend = not (money_pattern starts with '{{') %}
18+
{% set append = not (money_pattern ends with '}}') %}
19+
{% if prepend or append %}
20+
<div class="input-group">
21+
{% if prepend %}
22+
<span class="input-group-label">{{ money_pattern|form_encode_currency }}</span>
23+
{% endif %}
24+
{% set attr = attr|merge({class: (attr.class|default('') ~ ' input-group-field')|trim}) %}
25+
{{- block('form_widget_simple') -}}
26+
{% if append %}
27+
<span class="input-group-label">{{ money_pattern|form_encode_currency }}</span>
28+
{% endif %}
29+
</div>
30+
{% else %}
31+
{{- block('form_widget_simple') -}}
32+
{% endif %}
33+
{%- endblock money_widget %}
34+
35+
{% block percent_widget -%}
36+
{%- if symbol -%}
37+
<div class="input-group">
38+
{% set attr = attr|merge({class: (attr.class|default('') ~ ' input-group-field')|trim}) %}
39+
{{- block('form_widget_simple') -}}
40+
<span class="input-group-label">{{ symbol|default('%') }}</span>
41+
</div>
42+
{%- else -%}
43+
{{- block('form_widget_simple') -}}
44+
{%- endif -%}
45+
{%- endblock percent_widget %}
46+
47+
{% block button_widget -%}
48+
{% set attr = attr|merge({class: (attr.class|default('') ~ ' button')|trim}) %}
49+
{{- parent() -}}
50+
{%- endblock button_widget %}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.