custom/plugins/SwagCmsExtensions/src/Resources/views/storefront/element/custom-form/form-components/form-component-select.html.twig line 1

Open in your IDE?
  1. {% block swag_cms_extensions_form_component_select %}
  2.     <div class="form-group col-md-{{ field.width }}">
  3.         {% block swag_cms_extensions_form_component_select_content_label %}
  4.             <label class="form-label" for="form-{{ form.technicalName }}-{{ field.technicalName }}">
  5.                 {{- field.translated.label -}}{% if field.required %} {{- "general.required"|trans -}}{% endif %}
  6.             </label>
  7.         {% endblock %}
  8.         {% block swag_cms_extensions_form_component_select_content_select %}
  9.             <select name="{{ field.technicalName }}"
  10.                     id="form-{{ form.technicalName }}-{{ field.technicalName }}"
  11.                     class="custom-select contact-select{% if formViolations.getViolations('/' ~ field.technicalName) %} is-invalid{% endif %}"
  12.                     {% if field.required %}required="required"{% endif %}
  13.                     {% if field.translated.errorMessage %}data-form-validation-error-message="{{ field.translated.errorMessage }}"{% endif %}>
  14.                 <option {% if field.required %}disabled="disabled"{% endif %}
  15.                         selected="selected"
  16.                         value="">
  17.                     {{ field.translated.placeholder }}
  18.                 </option>
  19.                 {% for key, option in field.translated.config.options %}
  20.                     {% set valueAttribute = '' %}
  21.                     {% if field.config.entity is not null or field.translated.config.entity is not null %}
  22.                         {% set valueAttribute = ' value=' ~ key|default(option) %}
  23.                     {% endif %}
  24.                     <option{{ valueAttribute }}>
  25.                         {{ option }}
  26.                     </option>
  27.                 {% endfor %}
  28.             </select>
  29.             {% if formViolations.getViolations('/' ~ field.technicalName) is not empty %}
  30.                 {% sw_include '@Storefront/storefront/utilities/form-violation.html.twig'
  31.                     with { violationPath: '/' ~ field.technicalName}
  32.                 %}
  33.             {% endif %}
  34.         {% endblock %}
  35.     </div>
  36. {% endblock %}