{% load i18n widget_tweaks spider_rdf %}
{% for hidden in form.hidden_fields %}
{{ hidden }}
{% endfor %}
<ul class="w3-ul" rel="spkc:properties">
  {% for field in form.visible_fields %}
    <li class="{% if field.errors %}w3-pale-red{% endif %}" typeof="spkc:Property">
      <div class="">
        <div class="w3-cell w3-padding">
          <data hidden="hidden" property="spkc:fieldname">{{field.html_name}}</data>
          <data hidden="hidden" property="spkc:name">{{field.name}}</data>
          <div>{{ field.label_tag }}</div>
          {% comment %}
            {% if form.use_required_attribute and not field.required %}
            <div class="w3-text-grey w3-tiny">(optional)</div>{% endif %}
          {% endcomment %}
          {% if field.field.widget.input_type == "select" and field.field.widget.allow_multiple_selected %}
            {% for q in field.value %}
              {% literalize q as LiteralData %}
              <data hidden="hidden" property="spkc:value" datatype="{{LiteralData.datatype}}">{{LiteralData}}</data>
            {% endfor %}
          {% else %}
            {% literalize field as LiteralData %}
            <data hidden="hidden" property="spkc:value" datatype="{{LiteralData.datatype}}">{{LiteralData}}</data>
          {% endif %}
          {% block form_widget %}
          {% if field|widget_type == "checkboxselectmultiple" %}
          {% render_field field class+="w3-ul" %}
          {% else %}
          {% render_field field %}
          {% endif %}
          {% endblock form_widget %}
        </div>
        <div class="w3-cell w3-padding">
        {% if field.help_text %}
          <small class="w3-text-grey">{{ field.help_text|safe }}</small>
        {% endif %}
        </div>
      </div>
      {% if field.errors %}
        <div class="w3-text-red">
          <ul>
            {% for error in field.errors %}
            <li class="">
              {{ error }}
            </li>
            {% endfor %}
          </ul>
        </div>
      {% endif %}
    </li>
  {% empty %}{{form_empty_message|safe}}{% endfor %}
</ul>
