|
1 |
| -{% extends "widgets.html.twig" %} |
| 1 | +{% block field__rows %} |
| 2 | +{% spaceless %} |
| 3 | + {{ form_errors(context) }} |
| 4 | + {% for context in context.children %} |
| 5 | + {{ form_row(context) }} |
| 6 | + {% endfor %} |
| 7 | +{% endspaceless %} |
| 8 | +{% endblock field__rows %} |
| 9 | + |
| 10 | +{% block field__enctype %} |
| 11 | +{% spaceless %} |
| 12 | + {% if multipart %}enctype="multipart/form-data"{% endif %} |
| 13 | +{% endspaceless %} |
| 14 | +{% endblock field__enctype %} |
| 15 | + |
| 16 | +{% block field__errors %} |
| 17 | +{% spaceless %} |
| 18 | + {% if errors|length > 0 %} |
| 19 | + <ul> |
| 20 | + {% for error in errors %} |
| 21 | + <li>{% trans error.messageTemplate with error.messageParameters from 'validators' %}</li> |
| 22 | + {% endfor %} |
| 23 | + </ul> |
| 24 | + {% endif %} |
| 25 | +{% endspaceless %} |
| 26 | +{% endblock field__errors %} |
| 27 | + |
| 28 | +{% block field__rest %} |
| 29 | +{% spaceless %} |
| 30 | + {% for context in context.children %} |
| 31 | + {% if not context.rendered %} |
| 32 | + {{ form_row(context) }} |
| 33 | + {% endif %} |
| 34 | + {% endfor %} |
| 35 | +{% endspaceless %} |
| 36 | +{% endblock field__rest %} |
| 37 | + |
| 38 | +{% block field__label %} |
| 39 | +{% spaceless %} |
| 40 | + <label for="{{ id }}">{% trans label %}</label> |
| 41 | +{% endspaceless %} |
| 42 | +{% endblock field__label %} |
| 43 | + |
| 44 | +{% block attributes %} |
| 45 | +{% spaceless %} |
| 46 | + id="{{ id }}" name="{{ name }}"{% if class %} class="{{ class }}"{% endif %}{% if read_only %} disabled="disabled"{% endif %}{% if required %} required="required"{% endif %}{% if max_length %} maxlength="{{ max_length }}"{% endif %}{% if size %} size="{{ size }}"{% endif %} |
| 47 | + {% for attrname,attrvalue in attr %}{{attrname}}="{{attrvalue}}" {% endfor %} |
| 48 | +{% endspaceless %} |
| 49 | +{% endblock attributes %} |
| 50 | + |
| 51 | +{% block field__widget %} |
| 52 | +{% spaceless %} |
| 53 | + {% set type = type|default('text') %} |
| 54 | + <input type="{{ type }}" {{ block('attributes') }} value="{{ value }}" /> |
| 55 | +{% endspaceless %} |
| 56 | +{% endblock field__widget %} |
| 57 | + |
| 58 | +{% block text__widget %} |
| 59 | +{% spaceless %} |
| 60 | + {% set type = type|default('text') %} |
| 61 | + {{ block('field__widget') }} |
| 62 | +{% endspaceless %} |
| 63 | +{% endblock text__widget %} |
| 64 | + |
| 65 | +{% block password__widget %} |
| 66 | +{% spaceless %} |
| 67 | + {% set type = type|default('password') %} |
| 68 | + {{ block('field__widget') }} |
| 69 | +{% endspaceless %} |
| 70 | +{% endblock password__widget %} |
| 71 | + |
| 72 | +{% block hidden__widget %} |
| 73 | + {% set type = type|default('hidden') %} |
| 74 | + {{ block('field__widget') }} |
| 75 | +{% endblock hidden__widget %} |
| 76 | + |
| 77 | +{% block hidden__row %} |
| 78 | + {{ form_widget(context) }} |
| 79 | +{% endblock hidden__row %} |
| 80 | + |
| 81 | +{% block textarea__widget %} |
| 82 | +{% spaceless %} |
| 83 | + <textarea {{ block('attributes') }}>{{ value }}</textarea> |
| 84 | +{% endspaceless %} |
| 85 | +{% endblock textarea__widget %} |
| 86 | + |
| 87 | +{% block options %} |
| 88 | +{% spaceless %} |
| 89 | + {% for choice, label in options %} |
| 90 | + {% if context.choiceGroup(label) %} |
| 91 | + <optgroup label="{{ choice }}"> |
| 92 | + {% for nestedChoice, nestedLabel in label %} |
| 93 | + <option value="{{ nestedChoice }}"{% if context.choiceSelected(nestedChoice) %} selected="selected"{% endif %}>{{ nestedLabel }}</option> |
| 94 | + {% endfor %} |
| 95 | + </optgroup> |
| 96 | + {% else %} |
| 97 | + <option value="{{ choice }}"{% if context.choiceSelected(choice) %} selected="selected"{% endif %}>{{ label }}</option> |
| 98 | + {% endif %} |
| 99 | + {% endfor %} |
| 100 | +{% endspaceless %} |
| 101 | +{% endblock options %} |
| 102 | + |
| 103 | +{% block choice__widget %} |
| 104 | +{% spaceless %} |
| 105 | + {% if expanded %} |
| 106 | + {% for choice, child in context %} |
| 107 | + {{ form_widget(child) }} |
| 108 | + {{ child.setVar('label', context.choiceLabel(choice)) }} |
| 109 | + {{ form_label(child) }} |
| 110 | + {% endfor %} |
| 111 | + {% else %} |
| 112 | + <select {{ block('attributes') }}{% if multiple %} multiple="multiple"{% endif %}> |
| 113 | + {% if not required %} |
| 114 | + <option value="">{{ empty_value }}</option> |
| 115 | + {% endif %} |
| 116 | + {% if preferred_choices|length > 0 %} |
| 117 | + {% set options = preferred_choices %} |
| 118 | + {{ block('options') }} |
| 119 | + <option disabled="disabled">{{ separator }}</option> |
| 120 | + {% endif %} |
| 121 | + {% set options = choices %} |
| 122 | + {{ block('options') }} |
| 123 | + </select> |
| 124 | + {% endif %} |
| 125 | +{% endspaceless %} |
| 126 | +{% endblock choice__widget %} |
| 127 | + |
| 128 | +{% block checkbox__widget %} |
| 129 | +{% spaceless %} |
| 130 | + <input type="checkbox" {{ block('attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} /> |
| 131 | +{% endspaceless %} |
| 132 | +{% endblock checkbox__widget %} |
| 133 | + |
| 134 | +{% block radio__widget %} |
| 135 | +{% spaceless %} |
| 136 | + <input type="radio" {{ block('attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} /> |
| 137 | +{% endspaceless %} |
| 138 | +{% endblock radio__widget %} |
| 139 | + |
| 140 | +{% block datetime__widget %} |
| 141 | +{% spaceless %} |
| 142 | + <div {{ block('attributes') }}> |
| 143 | + {{ form_errors(context.date) }} |
| 144 | + {{ form_errors(context.time) }} |
| 145 | + {{ form_widget(context.date) }} |
| 146 | + {{ form_widget(context.time) }} |
| 147 | + </div> |
| 148 | +{% endspaceless %} |
| 149 | +{% endblock datetime__widget %} |
| 150 | + |
| 151 | +{% block date__widget %} |
| 152 | +{% spaceless %} |
| 153 | + {% if widget == 'text' %} |
| 154 | + {{ block('text__widget') }} |
| 155 | + {% else %} |
| 156 | + <div {{ block('attributes') }}> |
| 157 | + {{ date_pattern|replace({ |
| 158 | + '{{ year }}': form_widget(context.year), |
| 159 | + '{{ month }}': form_widget(context.month), |
| 160 | + '{{ day }}': form_widget(context.day), |
| 161 | + })|raw }} |
| 162 | + </div> |
| 163 | + {% endif %} |
| 164 | +{% endspaceless %} |
| 165 | +{% endblock date__widget %} |
| 166 | + |
| 167 | +{% block time__widget %} |
| 168 | +{% spaceless %} |
| 169 | + <div {{ block('attributes') }}> |
| 170 | + {{ form_widget(context.hour, { 'size': '1' }) }}:{{ form_widget(context.minute, { 'size': '1' }) }}{% if with_seconds %}:{{ form_widget(context.second, { 'size': '1' }) }}{% endif %} |
| 171 | + </div> |
| 172 | +{% endspaceless %} |
| 173 | +{% endblock time__widget %} |
| 174 | + |
| 175 | +{% block number__widget %} |
| 176 | +{% spaceless %} |
| 177 | + {# type="number" doesn't work with floats #} |
| 178 | + {% set type = type|default('text') %} |
| 179 | + {{ block('field__widget') }} |
| 180 | +{% endspaceless %} |
| 181 | +{% endblock number__widget %} |
| 182 | + |
| 183 | +{% block integer__widget %} |
| 184 | +{% spaceless %} |
| 185 | + {% set type = type|default('number') %} |
| 186 | + {{ block('field__widget') }} |
| 187 | +{% endspaceless %} |
| 188 | +{% endblock integer__widget %} |
| 189 | + |
| 190 | +{% block money__widget %} |
| 191 | +{% spaceless %} |
| 192 | + foo {{ money_pattern|replace({ '{{ widget }}': block('field__widget') })|raw }} |
| 193 | +{% endspaceless %} |
| 194 | +{% endblock money__widget %} |
| 195 | + |
| 196 | +{% block url__widget %} |
| 197 | +{% spaceless %} |
| 198 | + {% set type = type|default('url') %} |
| 199 | + {{ block('field__widget') }} |
| 200 | +{% endspaceless %} |
| 201 | +{% endblock url__widget %} |
| 202 | + |
| 203 | +{% block percent__widget %} |
| 204 | +{% spaceless %} |
| 205 | + {% set type = type|default('text') %} |
| 206 | + {{ block('field__widget') }} % |
| 207 | +{% endspaceless %} |
| 208 | +{% endblock percent__widget %} |
| 209 | + |
| 210 | +{% block file__widget %} |
| 211 | +{% spaceless %} |
| 212 | + <div {{ block('attributes') }}> |
| 213 | + {{ form_widget(context.file) }} |
| 214 | + {{ form_widget(context.token) }} |
| 215 | + {{ form_widget(context.name) }} |
| 216 | + </div> |
| 217 | +{% endspaceless %} |
| 218 | +{% endblock file__widget %} |
| 219 | + |
| 220 | +{% block collection__widget %} |
| 221 | +{% spaceless %} |
| 222 | + {{ block('form__widget') }} |
| 223 | +{% endspaceless %} |
| 224 | +{% endblock collection__widget %} |
| 225 | + |
| 226 | +{% block repeated__row %} |
| 227 | +{% spaceless %} |
| 228 | + {{ block('field__rows') }} |
| 229 | +{% endspaceless %} |
| 230 | +{% endblock repeated__row %} |
| 231 | + |
2 | 232 |
|
3 | 233 | {% block field__row %}
|
4 | 234 | {% spaceless %}
|
|
0 commit comments