Skip to content
Snippets Groups Projects
Commit 857f2d8c authored by Sebastian Castro's avatar Sebastian Castro
Browse files

form: adds custom id data attrs to taxonomy

parent d6f3e691
No related branches found
No related tags found
No related merge requests found
...@@ -14,19 +14,22 @@ ...@@ -14,19 +14,22 @@
{% if category.displayInForm %} {% if category.displayInForm %}
{% set categoryDepth = parentDepth is defined ? parentDepth + 1 : 0 %} {% set categoryDepth = parentDepth is defined ? parentDepth + 1 : 0 %}
<div class="category-field {{ displayInline ? 'inline' : ''}} {{ category.isMandatory ? 'mandatory' : '' }}" data-error-msg="{{ 'commons.choose_one_option'|trans }}"> <div class="category-field {{ displayInline ? 'inline' : ''}} {{ category.isMandatory ? 'mandatory' : '' }}"
data-id="{{ category.id }}"
data-custom-id="{{ category.customId }}"
data-error-msg="{{ 'commons.choose_one_option'|trans }}">
<span class="category-field-select input-field" data-picking-text='{{ category.pickingOptionText }}'> <span class="category-field-select input-field" data-picking-text='{{ category.pickingOptionText }}'>
<select id="category-field-{{category.id}}" class="category-select keep-title-option depth-{{ categoryDepth }}" <select id="category-field-{{category.id}}" class="category-select keep-title-option depth-{{ categoryDepth }}"
data-id="{{category.id}}" name="category-field-{{category.id}}" data-id="{{category.id}}" name="category-field-{{category.id}}"
data-single-option="{{category.singleOption}}"> data-single-option="{{category.singleOption}}">
<option disabled selected>{{ 'commons.choose_category'|trans({cat: category.pickingOptionText}) }} {{ category.isMandatory ? '' : 'commons.optional'|trans }}</option>
<option disabled selected>{{ 'commons.choose_category'|trans({cat: category.pickingOptionText}) }} {{ category.isMandatory ? '' : 'commons.optional'|trans }}</option>
{% for key, option in category.options %} {% for key, option in category.options %}
{% if option.displayInForm %} {% if option.displayInForm %}
<option value="{{option.id}}"> <option value="{{option.id}}" data-custom-id="{{option.customId}}">
{{ option.name }} {% if (option.textHelper is defined and option.textHelper) %} ({{ option.textHelper }}) {% endif %} {{ option.name }} {% if (option.textHelper is defined and option.textHelper) %} ({{ option.textHelper }}) {% endif %}
</option> </option>
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</select> </select>
...@@ -48,7 +51,7 @@ ...@@ -48,7 +51,7 @@
<div class="option-field depth-{{ categoryDepth }} {{ displayInline and not option.enableDescription ? 'inline' : ''}} {{ displayOption ? 'selected' : '' }}" <div class="option-field depth-{{ categoryDepth }} {{ displayInline and not option.enableDescription ? 'inline' : ''}} {{ displayOption ? 'selected' : '' }}"
id="option-field-{{option.id}}" id="option-field-{{option.id}}"
data-id="{{option.id}}" data-index={{curr_index}}> data-id="{{option.id}}" data-custom-id="{{option.customId}}" data-index={{curr_index}}>
<div class="option-field-value {{ (option.enableDescription or category.enableDescription) ? "with-description" : "" }}"> <div class="option-field-value {{ (option.enableDescription or category.enableDescription) ? "with-description" : "" }}">
...@@ -73,8 +76,8 @@ ...@@ -73,8 +76,8 @@
{% if option.displayChildrenInForm %} {% if option.displayChildrenInForm %}
<div class="subcategories-wrapper "> <div class="subcategories-wrapper ">
{% for subkey, subcategory in option.subcategories %} {% for subkey, subcategory in option.subcategories %}
{% include 'element-form/form-partials/taxonomy-field.html.twig' with {'category': subcategory, 'parentDepth': categoryDepth } %} {% include 'element-form/form-partials/taxonomy-field.html.twig' with {'category': subcategory, 'parentDepth': categoryDepth } %}
{% endfor %} {% endfor %}
</div> </div>
{% endif %} {% endif %}
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment