Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
form_div_layout.html.twig
001 {# Widgets #}
002
003 {%- block form_widget -%}
004 {% if compound %}
005 {{- block('form_widget_compound') -}}
006 {% else %}
007 {{- block('form_widget_simple') -}}
008 {% endif %}
009 {%- endblock form_widget -%}
010
011 {%- block form_widget_simple -%}
012 {%- set type = type|default('text') -%}
013 <input type="{{ type }}" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %}/>
014 {%- endblock form_widget_simple -%}
015
016 {%- block form_widget_compound -%}
017 <div {{ block('widget_container_attributes') }}>
018 {%- if form is rootform -%}
019 {{ form_errors(form) }}
020 {%- endif -%}
021 {{- block('form_rows') -}}
022 {{- form_rest(form) -}}
023 </div>
024 {%- endblock form_widget_compound -%}
025
026 {%- block collection_widget -%}
027 {% if prototype is defined and not prototype.rendered %}
028 {%- set attr = attr|merge({'data-prototype': form_row(prototype) }) -%}
029 {% endif %}
030 {{- block('form_widget') -}}
031 {%- endblock collection_widget -%}
032
033 {%- block textarea_widget -%}
034 <textarea {{ block('widget_attributes') }}>{{ value }}</textarea>
035 {%- endblock textarea_widget -%}
036
037 {%- block choice_widget -%}
038 {% if expanded %}
039 {{- block('choice_widget_expanded') -}}
040 {% else %}
041 {{- block('choice_widget_collapsed') -}}
042 {% endif %}
043 {%- endblock choice_widget -%}
044
045 {%- block choice_widget_expanded -%}
046 <div {{ block('widget_container_attributes') }}>
047 {%- for child in form %}
048 {{- form_widget(child) -}}
049 {{- form_label(child, null, {translation_domain: choice_translation_domain}) -}}
050 {% endfor -%}
051 </div>
052 {%- endblock choice_widget_expanded -%}
053
054 {%- block choice_widget_collapsed -%}
055 {%- if required and placeholder is none and not placeholder_in_choices and not multiple and (attr.size is not defined or attr.size <= 1) -%}
056 {% set required = false %}
057 {%- endif -%}
058 <select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}>
059 {%- if placeholder is not none -%}
060 <option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ placeholder != '' ? (translation_domain is same as(false) ? placeholder : placeholder|trans({}, translation_domain)) }}</option>
061 {%- endif -%}
062 {%- if preferred_choices|length > 0 -%}
063 {% set options = preferred_choices %}
064 {{- block('choice_widget_options') -}}
065 {%- if choices|length > 0 and separator is not none -%}
066 <option disabled="disabled">{{ separator }}</option>
067 {%- endif -%}
068 {%- endif -%}
069 {%- set options = choices -%}
070 {{- block('choice_widget_options') -}}
071 </select>
072 {%- endblock choice_widget_collapsed -%}
073
074 {%- block choice_widget_options -%}
075 {% for group_label, choice in options %}
076 {%- if choice is iterable -%}
077 <optgroup label="{{ choice_translation_domain is same as(false) ? group_label : group_label|trans({}, choice_translation_domain) }}">
078 {% set options = choice %}
079 {{- block('choice_widget_options') -}}
080 </optgroup>
081 {%- else -%}
082 <option value="{{ choice.value }}"{% if choice.attr %}{% with { attr: choice.attr } %}{{ block('attributes') }}{% endwith %}{% endif %}{% if choice is selectedchoice(value) %} selected="selected"{% endif %}>{{ choice_translation_domain is same as(false) ? choice.label : choice.label|trans({}, choice_translation_domain) }}</option>
083 {%- endif -%}
084 {% endfor %}
085 {%- endblock choice_widget_options -%}
086
087 {%- block checkbox_widget -%}
088 <input type="checkbox" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
089 {%- endblock checkbox_widget -%}
090
091 {%- block radio_widget -%}
092 <input type="radio" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
093 {%- endblock radio_widget -%}
094
095 {%- block datetime_widget -%}
096 {% if widget == 'single_text' %}
097 {{- block('form_widget_simple') -}}
098 {%- else -%}
099 <div {{ block('widget_container_attributes') }}>
100 {{- form_errors(form.date) -}}
101 {{- form_errors(form.time) -}}
102 {{- form_widget(form.date) -}}
103 {{- form_widget(form.time) -}}
104 </div>
105 {%- endif -%}
106 {%- endblock datetime_widget -%}
107
108 {%- block date_widget -%}
109 {%- if widget == 'single_text' -%}
110 {{ block('form_widget_simple') }}
111 {%- else -%}
112 <div {{ block('widget_container_attributes') }}>
113 {{- date_pattern|replace({
114 '{{ year }}': form_widget(form.year),
115 '{{ month }}': form_widget(form.month),
116 '{{ day }}': form_widget(form.day),
117 })|raw -}}
118 </div>
119 {%- endif -%}
120 {%- endblock date_widget -%}
121
122 {%- block time_widget -%}
123 {%- if widget == 'single_text' -%}
124 {{ block('form_widget_simple') }}
125 {%- else -%}
126 {%- set vars = widget == 'text' ? { 'attr': { 'size': 1 }} : {} -%}
127 <div {{ block('widget_container_attributes') }}>
128 {{ form_widget(form.hour, vars) }}{% if with_minutes %}:{{ form_widget(form.minute, vars) }}{% endif %}{% if with_seconds %}:{{ form_widget(form.second, vars) }}{% endif %}
129 </div>
130 {%- endif -%}
131 {%- endblock time_widget -%}
132
133 {%- block dateinterval_widget -%}
134 {%- if widget == 'single_text' -%}
135 {{- block('form_widget_simple') -}}
136 {%- else -%}
137 <div {{ block('widget_container_attributes') }}>
138 {{- form_errors(form) -}}
139 <table class="{{ table_class|default('') }}" role="presentation">
140 <thead>
141 <tr>
142 {%- if with_years %}<th>{{ form_label(form.years) }}</th>{% endif -%}
143 {%- if with_months %}<th>{{ form_label(form.months) }}</th>{% endif -%}
144 {%- if with_weeks %}<th>{{ form_label(form.weeks) }}</th>{% endif -%}
145 {%- if with_days %}<th>{{ form_label(form.days) }}</th>{% endif -%}
146 {%- if with_hours %}<th>{{ form_label(form.hours) }}</th>{% endif -%}
147 {%- if with_minutes %}<th>{{ form_label(form.minutes) }}</th>{% endif -%}
148 {%- if with_seconds %}<th>{{ form_label(form.seconds) }}</th>{% endif -%}
149 </tr>
150 </thead>
151 <tbody>
152 <tr>
153 {%- if with_years %}<td>{{ form_widget(form.years) }}</td>{% endif -%}
154 {%- if with_months %}<td>{{ form_widget(form.months) }}</td>{% endif -%}
155 {%- if with_weeks %}<td>{{ form_widget(form.weeks) }}</td>{% endif -%}
156 {%- if with_days %}<td>{{ form_widget(form.days) }}</td>{% endif -%}
157 {%- if with_hours %}<td>{{ form_widget(form.hours) }}</td>{% endif -%}
158 {%- if with_minutes %}<td>{{ form_widget(form.minutes) }}</td>{% endif -%}
159 {%- if with_seconds %}<td>{{ form_widget(form.seconds) }}</td>{% endif -%}
160 </tr>
161 </tbody>
162 </table>
163 {%- if with_invert %}{{ form_widget(form.invert) }}{% endif -%}
164 </div>
165 {%- endif -%}
166 {%- endblock dateinterval_widget -%}
167
168 {%- block number_widget -%}
169 {# type="number" doesn't work with floats #}
170 {%- set type = type|default('text') -%}
171 {{ block('form_widget_simple') }}
172 {%- endblock number_widget -%}
173
174 {%- block integer_widget -%}
175 {%- set type = type|default('number') -%}
176 {{ block('form_widget_simple') }}
177 {%- endblock integer_widget -%}
178
179 {%- block money_widget -%}
180 {{ money_pattern|form_encode_currency(block('form_widget_simple')) }}
181 {%- endblock money_widget -%}
182
183 {%- block url_widget -%}
184 {%- set type = type|default('url') -%}
185 {{ block('form_widget_simple') }}
186 {%- endblock url_widget -%}
187
188 {%- block search_widget -%}
189 {%- set type = type|default('search') -%}
190 {{ block('form_widget_simple') }}
191 {%- endblock search_widget -%}
192
193 {%- block percent_widget -%}
194 {%- set type = type|default('text') -%}
195 {{ block('form_widget_simple') }} %
196 {%- endblock percent_widget -%}
197
198 {%- block password_widget -%}
199 {%- set type = type|default('password') -%}
200 {{ block('form_widget_simple') }}
201 {%- endblock password_widget -%}
202
203 {%- block hidden_widget -%}
204 {%- set type = type|default('hidden') -%}
205 {{ block('form_widget_simple') }}
206 {%- endblock hidden_widget -%}
207
208 {%- block email_widget -%}
209 {%- set type = type|default('email') -%}
210 {{ block('form_widget_simple') }}
211 {%- endblock email_widget -%}
212
213 {%- block range_widget -%}
214 {% set type = type|default('range') %}
215 {{- block('form_widget_simple') -}}
216 {%- endblock range_widget %}
217
218 {%- block button_widget -%}
219 {%- if label is empty -%}
220 {%- if label_format is not empty -%}
221 {% set label = label_format|replace({
222 '%name%': name,
223 '%id%': id,
224 }) %}
225 {%- elseif label is not same as(false) -%}
226 {% set label = name|humanize %}
227 {%- endif -%}
228 {%- endif -%}
229 <button type="{{ type|default('button') }}" {{ block('button_attributes') }}>{{ translation_domain is same as(false) or label is same as(false) ? label : label|trans({}, translation_domain) }}</button>
230 {%- endblock button_widget -%}
231
232 {%- block submit_widget -%}
233 {%- set type = type|default('submit') -%}
234 {{ block('button_widget') }}
235 {%- endblock submit_widget -%}
236
237 {%- block reset_widget -%}
238 {%- set type = type|default('reset') -%}
239 {{ block('button_widget') }}
240 {%- endblock reset_widget -%}
241
242 {%- block tel_widget -%}
243 {%- set type = type|default('tel') -%}
244 {{ block('form_widget_simple') }}
245 {%- endblock tel_widget -%}
246
247 {%- block color_widget -%}
248 {%- set type = type|default('color') -%}
249 {{ block('form_widget_simple') }}
250 {%- endblock color_widget -%}
251
252 {# Labels #}
253
254 {%- block form_label -%}
255 {% if label is not same as(false) -%}
256 {% if not compound -%}
257 {% set label_attr = label_attr|merge({'for': id}) %}
258 {%- endif -%}
259 {% if required -%}
260 {% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %}
261 {%- endif -%}
262 {% if label is empty -%}
263 {%- if label_format is not empty -%}
264 {% set label = label_format|replace({
265 '%name%': name,
266 '%id%': id,
267 }) %}
268 {%- else -%}
269 {% set label = name|humanize %}
270 {%- endif -%}
271 {%- endif -%}
272 <{{ element|default('label') }}{% if label_attr %}{% with { attr: label_attr } %}{{ block('attributes') }}{% endwith %}{% endif %}>
273 {%- if translation_domain is same as(false) -%}
274 {{- label -}}
275 {%- else -%}
276 {{- label|trans({}, translation_domain) -}}
277 {%- endif -%}
278 </{{ element|default('label') }}>
279 {%- endif -%}
280 {%- endblock form_label -%}
281
282 {%- block button_label -%}{%- endblock -%}
283
284 {# Rows #}
285
286 {%- block repeated_row -%}
287 {#
288 No need to render the errors here, as all errors are mapped
289 to the first child (see RepeatedTypeValidatorExtension).
290 #}
291 {{- block('form_rows') -}}
292 {%- endblock repeated_row -%}
293
294 {%- block form_row -%}
295 <div>
296 {{- form_label(form) -}}
297 {{- form_errors(form) -}}
298 {{- form_widget(form) -}}
299 </div>
300 {%- endblock form_row -%}
301
302 {%- block button_row -%}
303 <div>
304 {{- form_widget(form) -}}
305 </div>
306 {%- endblock button_row -%}
307
308 {%- block hidden_row -%}
309 {{ form_widget(form) }}
310 {%- endblock hidden_row -%}
311
312 {# Misc #}
313
314 {%- block form -%}
315 {{ form_start(form) }}
316 {{- form_widget(form) -}}
317 {{ form_end(form) }}
318 {%- endblock form -%}
319
320 {%- block form_start -%}
321 {%- do form.setMethodRendered() -%}
322 {% set method = method|upper %}
323 {%- if method in ["GET", "POST"] -%}
324 {% set form_method = method %}
325 {%- else -%}
326 {% set form_method = "POST" %}
327 {%- endif -%}
328 <form{% if name != '' %} name="{{ name }}"{% endif %} method="{{ form_method|lower }}"{% if action != '' %} action="{{ action }}"{% endif %}{{ block('attributes') }}{% if multipart %} enctype="multipart/form-data"{% endif %}>
329 {%- if form_method != method -%}
330 <input type="hidden" name="_method" value="{{ method }}" />
331 {%- endif -%}
332 {%- endblock form_start -%}
333
334 {%- block form_end -%}
335 {%- if not render_rest is defined or render_rest -%}
336 {{ form_rest(form) }}
337 {%- endif -%}
338 </form>
339 {%- endblock form_end -%}
340
341 {%- block form_errors -%}
342 {%- if errors|length > 0 -%}
343 <ul>
344 {%- for error in errors -%}
345 <li>{{ error.message }}</li>
346 {%- endfor -%}
347 </ul>
348 {%- endif -%}
349 {%- endblock form_errors -%}
350
351 {%- block form_rest -%}
352 {% for child in form -%}
353 {% if not child.rendered %}
354 {{- form_row(child) -}}
355 {% endif %}
356 {%- endfor -%}
357
358 {% if not form.methodRendered and form is rootform %}
359 {%- do form.setMethodRendered() -%}
360 {% set method = method|upper %}
361 {%- if method in ["GET", "POST"] -%}
362 {% set form_method = method %}
363 {%- else -%}
364 {% set form_method = "POST" %}
365 {%- endif -%}
366
367 {%- if form_method != method -%}
368 <input type="hidden" name="_method" value="{{ method }}" />
369 {%- endif -%}
370 {% endif -%}
371 {% endblock form_rest %}
372
373 {# Support #}
374
375 {%- block form_rows -%}
376 {% for child in form %}
377 {{- form_row(child) -}}
378 {% endfor %}
379 {%- endblock form_rows -%}
380
381 {%- block widget_attributes -%}
382 id="{{ id }}" name="{{ full_name }}"
383 {%- if disabled %} disabled="disabled"{% endif -%}
384 {%- if required %} required="required"{% endif -%}
385 {{ block('attributes') }}
386 {%- endblock widget_attributes -%}
387
388 {%- block widget_container_attributes -%}
389 {%- if id is not empty %}id="{{ id }}"{% endif -%}
390 {{ block('attributes') }}
391 {%- endblock widget_container_attributes -%}
392
393 {%- block button_attributes -%}
394 id="{{ id }}" name="{{ full_name }}"{% if disabled %} disabled="disabled"{% endif -%}
395 {{ block('attributes') }}
396 {%- endblock button_attributes -%}
397
398 {% block attributes -%}
399 {%- for attrname, attrvalue in attr -%}
400 {{- " " -}}
401 {%- if attrname in ['placeholder', 'title'] -%}
402 {{- attrname }}="{{ translation_domain is same as(false) or attrvalue is null ? attrvalue : attrvalue|trans({}, translation_domain) }}"
403 {%- elseif attrvalue is same as(true) -%}
404 {{- attrname }}="{{ attrname }}"
405 {%- elseif attrvalue is not same as(false) -%}
406 {{- attrname }}="{{ attrvalue }}"
407 {%- endif -%}
408 {%- endfor -%}
409 {%- endblock attributes -%}
410