/
form_layout.twig
265 lines (235 loc) · 9.1 KB
/
form_layout.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
{#
This file is part of EC-CUBE
Copyright(c) 2000-2015 LOCKON CO.,LTD. All Rights Reserved.
http://www.lockon.co.jp/
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#}
{%- extends 'form_table_layout.html.twig' -%}
{%- block form_widget_compound -%}
{%- if form.vars.freeze_display_text -%}
<table {{ block('widget_container_attributes') }}>
{%- if form.parent is empty and errors|length > 0 -%}
<tr>
<td colspan="2">
{{- form_errors(form) -}}
</td>
</tr>
{%- endif -%}
{{- block('form_rows') -}}
{{- form_rest(form) -}}
</table>
{%- else -%}
{{- form_errors(form) -}}
{{- block('form_rows') -}}
{{- form_rest(form) -}}
{%- endif -%}
{%- endblock form_widget_compound -%}
{%- block form_row -%}
{%- if form.vars.freeze_display_text -%}
<tr>
<th>
{{- form_label(form) -}}
{% if form.vars.required %}<span class="attention">※</span>{% endif %}
</th>
<td>
{{- form_errors(form) -}}
{{- form_widget(form) -}}
</td>
</tr>
{%- else -%}
{{- form_errors(form) -}}
{{- form_widget(form) -}}
{%- endif -%}
{%- endblock form_row -%}
{%- block form_errors -%}
{%- if errors|length > 0 -%}
{%- for error in errors -%}
<span class="attention">※ {{ error.messageTemplate|trans(error.messageParameters, 'validators')|replace({'{{ field }}': label}) }}<br /></span>
{%- endfor -%}
{%- endif -%}
{%- endblock form_errors -%}
{# Widgets #}
{%- block form_widget -%}
{{- parent() -}}
{%- if freeze == false -%}
{%- if help is defined and help is not empty -%}
<p class="mini"><span class="attention">{{ help|trans({}, translation_domain) }}</span></p>
{%- endif -%}
{%- endif -%}
{%- endblock form_widget -%}
{%- block form_widget_simple -%}
{%- if freeze -%}
{%- set type = 'hidden' -%}
{%- if freeze_display_text -%}
{{- value|default('')|nl2br -}}
{%- endif -%}
{%- endif -%}
{{- parent() -}}
{%- endblock form_widget_simple -%}
{%- block widget_attributes -%}
{%- if errors|length > 0 -%}
{%- set style = 'background-color:#ffe8e8;' -%}
{%- if attr -%}
{%- if attr['style'] is defined and attr['style']|length > 0 -%}
{%- set style = style~' '~attr['style'] -%}
{%- endif -%}
{%- set attr = attr|merge({'style': style}) -%}
{%- else -%}
{%- set attr = {'style': style} -%}
{%- endif -%}
{%- endif -%}
id="{{ id }}" name="{{ full_name }}"{%- if read_only -%} disabled="disabled"{% endif %}{% if required %} required="required"{% endif %}{% if pattern %} pattern="{{ pattern }}"{% endif -%}
{%- if freeze == false -%}
{%- for attrname,attrvalue in attr %} {{attrname}}="{{attrvalue}}" {% endfor -%}
{%- endif -%}
{%- endblock widget_attributes -%}
{%- block hidden_row -%}
{%- if freeze_display_text -%}
<tr style="display: none">
<td colspan="2">
{{- form_widget(form) -}}
</td>
</tr>
{%- else -%}
{{- form_widget(form) -}}
{%- endif -%}
{%- endblock hidden_row -%}
{%- block textarea_widget -%}
{%- if freeze -%}
{{- block('form_widget_simple') -}}
{%- else -%}
{{- parent() -}}
{%- if help is defined and help is not empty -%}
<p class="mini"><span class="attention">{{ help|trans({}, translation_domain) }}</span></p>
{%- endif -%}
{%- endif -%}
{%- endblock textarea_widget -%}
{%- block choice_widget_collapsed -%}
{% if freeze %}
{% set flag = false %}
{% for choice in choices %}
{% if choice is selectedchoice(value) %}
{%- if freeze_display_text -%}
{{ choice.label|trans({}, translation_domain) }}
{% endif %}
<input type="hidden" value="{{ choice.value }}" {{ block('widget_attributes') }} />
{% set flag = true %}
{% endif %}
{% endfor %}
{% if flag == false %}<input type="hidden" value="" {{ block('widget_attributes') }} />{% endif %}
{%- else -%}
{{- parent() -}}
{%- endif -%}
{%- endblock choice_widget_collapsed -%}
{%- block choice_widget_expanded -%}
{% if freeze %}
{%- if freeze_display_text -%}
{{ form.vars.data.name|default(form.vars.data) }}
{%- endif -%}
<input type="hidden" value="{{ form.vars.data.id|default(form.vars.data) }}" {{ block('widget_attributes') }} />
{%- else -%}
{{- parent() -}}
{%- endif -%}
{%- endblock choice_widget_expanded -%}
{%- block checkbox_widget -%}
{%- if freeze -%}
{%- if checked -%}
{%- if freeze_display_text -%}
{{ block('form_label') }}
{%- endif -%}
<input type="hidden" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %} />
{%- endif -%}
{%- else -%}
{{- parent() -}}
{%- endif -%}
{%- endblock checkbox_widget -%}
{%- block radio_widget -%}
{%- if freeze -%}
{%- if checked -%}
{%- if freeze_display_text -%}
{{ block('form_label') }}
{%- endif -%}
<input type="hidden" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %} />
{%- endif -%}
{%- else -%}
{{- parent() -}}
{%- endif -%}
{%- endblock radio_widget -%}
{%- block password_widget -%}
{%- if freeze -%}
<input type="hidden" {{ block('widget_attributes') }} value="{{ form.vars.data }}" />
{%- else -%}
{{- parent() -}}
{%- endif -%}
{%- endblock password_widget -%}
{# EC-CUBE Widget #}
{%- block name_widget -%}
{%- for child in form %}
{{- form_errors(child) -}}
{% endfor -%}
{%- if freeze -%}
{{- form_widget(form[form.vars.name01]) -}}
{{- form_widget(form[form.vars.name02]) -}}
{%- else -%}
{{- form_widget(form[form.vars.name01]) -}}
{{- form_widget(form[form.vars.name02]) -}}
{%- endif -%}
{%- if loop.last == false%} {% endif -%}
{%- endblock name_widget -%}
{%- block tel_widget -%}
{%- for child in form %}
{{- form_errors(child) -}}
{% endfor -%}
{%- for child in form %}
{{- form_widget(child, {'attr': {'style': 'ime-mode: disabled;'}}) -}}
{%- if loop.last == false%} - {% endif -%}
{% endfor -%}
{%- endblock tel_widget -%}
{%- block fax_widget -%}
{%- for child in form %}
{{- form_errors(child) -}}
{% endfor -%}
{%- for child in form %}
{{- form_widget(child, {'attr': {'style': 'ime-mode: disabled;'}}) -}}
{%- if loop.last == false%} - {% endif -%}
{% endfor -%}
{%- endblock fax_widget -%}
{%- block zip_widget -%}
{%- for child in form %}
{{- form_errors(child) -}}
{% endfor -%}
{%- if freeze -%}
〒 {{ form_widget(form[form.vars.zip01_name]) }} - {{- form_widget(form[form.vars.zip02_name]) }}
{%- else -%}
〒 {{ form_widget(form[form.vars.zip01_name], {'attr': {'style': 'ime-mode: disabled;'}}) }} -
{{- form_widget(form[form.vars.zip02_name], {'attr': {'style': 'ime-mode: disabled;'}}) }}
<a class="btn-normal" href="javascript:;" name="address_input" onclick="eccube.getAddress('{{ path('input_zip') }}', 'zip01', 'zip02', 'pref', 'addr01'); return false;">住所入力</a>
{%- endif -%}
{%- endblock zip_widget -%}
{%- block address_widget -%}
{%- for child in form %}
{{- form_errors(child) -}}
{% endfor -%}
{%- if freeze -%}
{{- form_widget(form[form.vars.pref_name]) -}}
{{- form_widget(form[form.vars.addr01_name]) -}}
{{- form_widget(form[form.vars.addr02_name]) -}}
{%- else -%}
{{- form_widget(form[form.vars.pref_name]) -}}<br />
{{- form_widget(form[form.vars.addr01_name], {'attr': {'style': 'ime-mode: active;'}}) -}}<br />
{{- form_widget(form[form.vars.addr02_name], {'attr': {'style': 'ime-mode: active;'}}) -}}<br />
{%- if help is defined and help is not empty -%}
<span class="attention">{{ help|trans({}, translation_domain) }}</span>
{%- endif -%}
{%- endif -%}
{%- endblock address_widget -%}