[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/symfony/twig-bridge/Resources/views/Form/ -> form_div_layout.html.twig (source)

   1  {# Widgets #}
   2  
   3  {%- block form_widget -%}
   4      {% if compound %}
   5          {{- block('form_widget_compound') -}}
   6      {% else %}
   7          {{- block('form_widget_simple') -}}
   8      {% endif %}
   9  {%- endblock form_widget -%}
  10  
  11  {%- block form_widget_simple -%}
  12      {%- set type = type|default('text') -%}
  13      <input type="{{ type }}" {{ block('widget_attributes') }} {% if value is not empty %}value="{{ value }}" {% endif %}/>
  14  {%- endblock form_widget_simple -%}
  15  
  16  {%- block form_widget_compound -%}
  17      <div {{ block('widget_container_attributes') }}>
  18          {%- if form is rootform -%}
  19              {{ form_errors(form) }}
  20          {%- endif -%}
  21          {{- block('form_rows') -}}
  22          {{- form_rest(form) -}}
  23      </div>
  24  {%- endblock form_widget_compound -%}
  25  
  26  {%- block collection_widget -%}
  27      {% if prototype is defined %}
  28          {%- set attr = attr|merge({'data-prototype': form_row(prototype) }) -%}
  29      {% endif %}
  30      {{- block('form_widget') -}}
  31  {%- endblock collection_widget -%}
  32  
  33  {%- block textarea_widget -%}
  34      <textarea {{ block('widget_attributes') }}>{{ value }}</textarea>
  35  {%- endblock textarea_widget -%}
  36  
  37  {%- block choice_widget -%}
  38      {% if expanded %}
  39          {{- block('choice_widget_expanded') -}}
  40      {% else %}
  41          {{- block('choice_widget_collapsed') -}}
  42      {% endif %}
  43  {%- endblock choice_widget -%}
  44  
  45  {%- block choice_widget_expanded -%}
  46      <div {{ block('widget_container_attributes') }}>
  47      {%- for child in form %}
  48          {{- form_widget(child) -}}
  49          {{- form_label(child, null, {translation_domain: choice_translation_domain}) -}}
  50      {% endfor -%}
  51      </div>
  52  {%- endblock choice_widget_expanded -%}
  53  
  54  {%- block choice_widget_collapsed -%}
  55      {%- if required and placeholder is none and not placeholder_in_choices and not multiple and (attr.size is not defined or attr.size <= 1) -%}
  56          {% set required = false %}
  57      {%- endif -%}
  58      <select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}>
  59          {%- if placeholder is not none -%}
  60              <option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ placeholder != '' ? (translation_domain is same as(false) ? placeholder : placeholder|trans({}, translation_domain)) }}</option>
  61          {%- endif -%}
  62          {%- if preferred_choices|length > 0 -%}
  63              {% set options = preferred_choices %}
  64              {{- block('choice_widget_options') -}}
  65              {%- if choices|length > 0 and separator is not none -%}
  66                  <option disabled="disabled">{{ separator }}</option>
  67              {%- endif -%}
  68          {%- endif -%}
  69          {%- set options = choices -%}
  70          {{- block('choice_widget_options') -}}
  71      </select>
  72  {%- endblock choice_widget_collapsed -%}
  73  
  74  {%- block choice_widget_options -%}
  75      {% for group_label, choice in options %}
  76          {%- if choice is iterable -%}
  77              <optgroup label="{{ choice_translation_domain is same as(false) ? group_label : group_label|trans({}, choice_translation_domain) }}">
  78                  {% set options = choice %}
  79                  {{- block('choice_widget_options') -}}
  80              </optgroup>
  81          {%- else -%}
  82              <option value="{{ choice.value }}"{% if choice.attr %} {% set attr = choice.attr %}{{ block('attributes') }}{% 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>
  83          {%- endif -%}
  84      {% endfor %}
  85  {%- endblock choice_widget_options -%}
  86  
  87  {%- block checkbox_widget -%}
  88      <input type="checkbox" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
  89  {%- endblock checkbox_widget -%}
  90  
  91  {%- block radio_widget -%}
  92      <input type="radio" {{ block('widget_attributes') }}{% if value is defined %} value="{{ value }}"{% endif %}{% if checked %} checked="checked"{% endif %} />
  93  {%- endblock radio_widget -%}
  94  
  95  {%- block datetime_widget -%}
  96      {% if widget == 'single_text' %}
  97          {{- block('form_widget_simple') -}}
  98      {%- else -%}
  99          <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 number_widget -%}
 134      {# type="number" doesn't work with floats #}
 135      {%- set type = type|default('text') -%}
 136      {{ block('form_widget_simple') }}
 137  {%- endblock number_widget -%}
 138  
 139  {%- block integer_widget -%}
 140      {%- set type = type|default('number') -%}
 141      {{ block('form_widget_simple') }}
 142  {%- endblock integer_widget -%}
 143  
 144  {%- block money_widget -%}
 145      {{ money_pattern|form_encode_currency(block('form_widget_simple')) }}
 146  {%- endblock money_widget -%}
 147  
 148  {%- block url_widget -%}
 149      {%- set type = type|default('url') -%}
 150      {{ block('form_widget_simple') }}
 151  {%- endblock url_widget -%}
 152  
 153  {%- block search_widget -%}
 154      {%- set type = type|default('search') -%}
 155      {{ block('form_widget_simple') }}
 156  {%- endblock search_widget -%}
 157  
 158  {%- block percent_widget -%}
 159      {%- set type = type|default('text') -%}
 160      {{ block('form_widget_simple') }} %
 161  {%- endblock percent_widget -%}
 162  
 163  {%- block password_widget -%}
 164      {%- set type = type|default('password') -%}
 165      {{ block('form_widget_simple') }}
 166  {%- endblock password_widget -%}
 167  
 168  {%- block hidden_widget -%}
 169      {%- set type = type|default('hidden') -%}
 170      {{ block('form_widget_simple') }}
 171  {%- endblock hidden_widget -%}
 172  
 173  {%- block email_widget -%}
 174      {%- set type = type|default('email') -%}
 175      {{ block('form_widget_simple') }}
 176  {%- endblock email_widget -%}
 177  
 178  {%- block range_widget -%}
 179      {% set type = type|default('range') %}
 180      {{- block('form_widget_simple') -}}
 181  {%- endblock range_widget %}
 182  
 183  {%- block button_widget -%}
 184      {%- if label is empty -%}
 185          {%- if label_format is not empty -%}
 186              {% set label = label_format|replace({
 187                  '%name%': name,
 188                  '%id%': id,
 189              }) %}
 190          {%- else -%}
 191              {% set label = name|humanize %}
 192          {%- endif -%}
 193      {%- endif -%}
 194      <button type="{{ type|default('button') }}" {{ block('button_attributes') }}>{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}</button>
 195  {%- endblock button_widget -%}
 196  
 197  {%- block submit_widget -%}
 198      {%- set type = type|default('submit') -%}
 199      {{ block('button_widget') }}
 200  {%- endblock submit_widget -%}
 201  
 202  {%- block reset_widget -%}
 203      {%- set type = type|default('reset') -%}
 204      {{ block('button_widget') }}
 205  {%- endblock reset_widget -%}
 206  
 207  {# Labels #}
 208  
 209  {%- block form_label -%}
 210      {% if label is not same as(false) -%}
 211          {% if not compound -%}
 212              {% set label_attr = label_attr|merge({'for': id}) %}
 213          {%- endif -%}
 214          {% if required -%}
 215              {% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %}
 216          {%- endif -%}
 217          {% if label is empty -%}
 218              {%- if label_format is not empty -%}
 219                  {% set label = label_format|replace({
 220                      '%name%': name,
 221                      '%id%': id,
 222                  }) %}
 223              {%- else -%}
 224                  {% set label = name|humanize %}
 225              {%- endif -%}
 226          {%- endif -%}
 227          <label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
 228              {%- if translation_domain is same as(false) -%}
 229                  {{- label -}}
 230              {%- else -%}
 231                  {{- label|trans({}, translation_domain) -}}
 232              {%- endif -%}
 233          </label>
 234      {%- endif -%}
 235  {%- endblock form_label -%}
 236  
 237  {%- block button_label -%}{%- endblock -%}
 238  
 239  {# Rows #}
 240  
 241  {%- block repeated_row -%}
 242      {#
 243      No need to render the errors here, as all errors are mapped
 244      to the first child (see RepeatedTypeValidatorExtension).
 245      #}
 246      {{- block('form_rows') -}}
 247  {%- endblock repeated_row -%}
 248  
 249  {%- block form_row -%}
 250      <div>
 251          {{- form_label(form) -}}
 252          {{- form_errors(form) -}}
 253          {{- form_widget(form) -}}
 254      </div>
 255  {%- endblock form_row -%}
 256  
 257  {%- block button_row -%}
 258      <div>
 259          {{- form_widget(form) -}}
 260      </div>
 261  {%- endblock button_row -%}
 262  
 263  {%- block hidden_row -%}
 264      {{ form_widget(form) }}
 265  {%- endblock hidden_row -%}
 266  
 267  {# Misc #}
 268  
 269  {%- block form -%}
 270      {{ form_start(form) }}
 271          {{- form_widget(form) -}}
 272      {{ form_end(form) }}
 273  {%- endblock form -%}
 274  
 275  {%- block form_start -%}
 276      {%- do form.setMethodRendered() -%}
 277      {% set method = method|upper %}
 278      {%- if method in ["GET", "POST"] -%}
 279          {% set form_method = method %}
 280      {%- else -%}
 281          {% set form_method = "POST" %}
 282      {%- endif -%}
 283      <form{% if name != '' %} name="{{ name }}"{% endif %} method="{{ form_method|lower }}"{% if action != '' %} action="{{ action }}"{% endif %}{% for attrname, attrvalue in attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}{% if multipart %} enctype="multipart/form-data"{% endif %}>
 284      {%- if form_method != method -%}
 285          <input type="hidden" name="_method" value="{{ method }}" />
 286      {%- endif -%}
 287  {%- endblock form_start -%}
 288  
 289  {%- block form_end -%}
 290      {%- if not render_rest is defined or render_rest -%}
 291          {{ form_rest(form) }}
 292      {%- endif -%}
 293      </form>
 294  {%- endblock form_end -%}
 295  
 296  {%- block form_enctype -%}
 297      {% if multipart %}enctype="multipart/form-data"{% endif %}
 298  {%- endblock form_enctype -%}
 299  
 300  {%- block form_errors -%}
 301      {%- if errors|length > 0 -%}
 302      <ul>
 303          {%- for error in errors -%}
 304              <li>{{ error.message }}</li>
 305          {%- endfor -%}
 306      </ul>
 307      {%- endif -%}
 308  {%- endblock form_errors -%}
 309  
 310  {%- block form_rest -%}
 311      {% for child in form -%}
 312          {% if not child.rendered %}
 313              {{- form_row(child) -}}
 314          {% endif %}
 315      {%- endfor -%}
 316  
 317      {% if not form.methodRendered and form is rootform %}
 318          {%- do form.setMethodRendered() -%}
 319          {% set method = method|upper %}
 320          {%- if method in ["GET", "POST"] -%}
 321              {% set form_method = method %}
 322          {%- else -%}
 323              {% set form_method = "POST" %}
 324          {%- endif -%}
 325  
 326          {%- if form_method != method -%}
 327              <input type="hidden" name="_method" value="{{ method }}" />
 328          {%- endif -%}
 329      {% endif -%}
 330  {% endblock form_rest %}
 331  
 332  {# Support #}
 333  
 334  {%- block form_rows -%}
 335      {% for child in form %}
 336          {{- form_row(child) -}}
 337      {% endfor %}
 338  {%- endblock form_rows -%}
 339  
 340  {%- block widget_attributes -%}
 341      id="{{ id }}" name="{{ full_name }}"
 342      {%- if read_only %} readonly="readonly"{% endif -%}
 343      {%- if disabled %} disabled="disabled"{% endif -%}
 344      {%- if required %} required="required"{% endif -%}
 345      {%- for attrname, attrvalue in attr if 'readonly' != attrname or not read_only -%}
 346          {{- " " -}}
 347          {%- if attrname in ['placeholder', 'title'] -%}
 348              {{- attrname }}="{{ translation_domain is same as(false) ? attrvalue : attrvalue|trans({}, translation_domain) }}"
 349          {%- elseif attrvalue is same as(true) -%}
 350              {{- attrname }}="{{ attrname }}"
 351          {%- elseif attrvalue is not same as(false) -%}
 352              {{- attrname }}="{{ attrvalue }}"
 353          {%- endif -%}
 354      {%- endfor -%}
 355  {%- endblock widget_attributes -%}
 356  
 357  {%- block widget_container_attributes -%}
 358      {%- if id is not empty %}id="{{ id }}"{% endif -%}
 359      {%- for attrname, attrvalue in attr -%}
 360          {{- " " -}}
 361          {%- if attrname in ['placeholder', 'title'] -%}
 362              {{- attrname }}="{{ translation_domain is same as(false) ? attrvalue : attrvalue|trans({}, translation_domain) }}"
 363          {%- elseif attrvalue is same as(true) -%}
 364              {{- attrname }}="{{ attrname }}"
 365          {%- elseif attrvalue is not same as(false) -%}
 366              {{- attrname }}="{{ attrvalue }}"
 367          {%- endif -%}
 368      {%- endfor -%}
 369  {%- endblock widget_container_attributes -%}
 370  
 371  {%- block button_attributes -%}
 372      id="{{ id }}" name="{{ full_name }}"{% if disabled %} disabled="disabled"{% endif -%}
 373      {%- for attrname, attrvalue in attr -%}
 374          {{- " " -}}
 375          {%- if attrname in ['placeholder', 'title'] -%}
 376              {{- attrname }}="{{ translation_domain is same as(false) ? attrvalue : attrvalue|trans({}, translation_domain) }}"
 377          {%- elseif attrvalue is same as(true) -%}
 378              {{- attrname }}="{{ attrname }}"
 379          {%- elseif attrvalue is not same as(false) -%}
 380              {{- attrname }}="{{ attrvalue }}"
 381          {%- endif -%}
 382      {%- endfor -%}
 383  {%- endblock button_attributes -%}
 384  
 385  {% block attributes -%}
 386      {%- for attrname, attrvalue in attr -%}
 387          {{- " " -}}
 388          {%- if attrname in ['placeholder', 'title'] -%}
 389              {{- attrname }}="{{ translation_domain is same as(false) ? attrvalue : attrvalue|trans({}, translation_domain) }}"
 390          {%- elseif attrvalue is same as(true) -%}
 391              {{- attrname }}="{{ attrname }}"
 392          {%- elseif attrvalue is not same as(false) -%}
 393              {{- attrname }}="{{ attrvalue }}"
 394          {%- endif -%}
 395      {%- endfor -%}
 396  {%- endblock attributes -%}


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1