-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
@scottnath commented on Mon Oct 31 2016
When content-types merges a content type with input plugins and there is a repeatable attribute, then it wraps that set of inputs in an array instead of making it an object and it creates multiple versions of the same input object with minor differences to increment the id.
Problems
- Creates a more complicated merged ct to parse
- Creates confusing select options
Steps for Reproducing
- create a content type with a repeatable attribute
- look at the post-merge output from content-types
example code
Configuration YAML:
- type: reference
id: bar-reference
name: Bar reference
repeatable:
min: 5
max: 10
inputs:
reference:
settings:
contentType: servicesMerged content type from CT:
{
"name": "Bar reference",
"description": "An input plugin with reference",
"validation": {},
"inputs": [
{
"reference": {
"validation": {
"function": "referenceValidation",
"on": "change"
},
"type": "select",
"reference": true,
"label": "Bar reference",
"options": [],
"settings": {
"view": "select",
"placeholder": "-- Choose One --",
"contentType": "services"
},
"id": "9ba6bfd3-8a59-48fe-8bc7-e2f15e89d8cc--0",
"name": "bar-reference--reference--0"
}
},
{
"reference": {
"validation": {
"function": "referenceValidation",
"on": "change"
},
"type": "select",
"reference": true,
"label": "Bar reference",
"options": [],
"settings": {
"view": "select",
"placeholder": "-- Choose One --",
"contentType": "services"
},
"id": "9ba6bfd3-8a59-48fe-8bc7-e2f15e89d8cc--1",
"name": "bar-reference--reference--1"
}
},
{
"reference": {
"validation": {
"function": "referenceValidation",
"on": "change"
},
"type": "select",
"reference": true,
"label": "Bar reference",
"options": [],
"settings": {
"view": "select",
"placeholder": "-- Choose One --",
"contentType": "services"
},
"id": "9ba6bfd3-8a59-48fe-8bc7-e2f15e89d8cc--2",
"name": "bar-reference--reference--2"
}
},
{
"reference": {
"validation": {
"function": "referenceValidation",
"on": "change"
},
"type": "select",
"reference": true,
"label": "Bar reference",
"options": [],
"settings": {
"view": "select",
"placeholder": "-- Choose One --",
"contentType": "services"
},
"id": "9ba6bfd3-8a59-48fe-8bc7-e2f15e89d8cc--3",
"name": "bar-reference--reference--3"
}
},
{
"reference": {
"validation": {
"function": "referenceValidation",
"on": "change"
},
"type": "select",
"reference": true,
"label": "Bar reference",
"options": [],
"settings": {
"view": "select",
"placeholder": "-- Choose One --",
"contentType": "services"
},
"id": "9ba6bfd3-8a59-48fe-8bc7-e2f15e89d8cc--4",
"name": "bar-reference--reference--4"
}
}
],
"html": "{% if reference.type == \"radio\" %}<ul>{% for option in reference.options %}<li><input type=\"{{reference.type}}\" name=\"{{reference.name}}\" id=\"{{reference.id}}--{{loop.index}}\" value=\"{{option.value}}\" {% if option.value == reference.value %}checked{% endif %}><label for=\"{{reference.id}}--{{loop.index}}\">{{option.label}}</label></li>{% endfor %}</ul>{% else %}<label for=\"{{reference.id}}\">{{reference.label}}</label><select id=\"{{reference.id}}\" name=\"{{reference.name}}\">{% for option in reference.options %}<option value=\"{{option.value}}\"{% if option.value == reference.value %}selected{% endif %}>{{option.label}}</option>{% endfor %}</select>{% endif %}",
"id": "bar-reference",
"type": "reference",
"repeatable": {
"min": 5,
"max": 10
}
},Screenshots
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
