diff --git a/CHANGELOG.md b/CHANGELOG.md index 27413fb..9bb29e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,9 @@ * :warning: Rename field type `cycleway` to `directionalCombo` ([#79]) * Introduce new `date` field type ([#76]) * Allow the `Röntgen` icon set to be used for icons ([#75]) +* Allow to specify icons for values of combo fields ([#56]) +[#56]: https://github.com/ideditor/schema-builder/issues/56 [#75]: https://github.com/ideditor/schema-builder/issues/75 [#76]: https://github.com/ideditor/schema-builder/issues/76 [#79]: https://github.com/ideditor/schema-builder/issues/79 diff --git a/README.md b/README.md index c668529..dceb507 100644 --- a/README.md +++ b/README.md @@ -656,6 +656,30 @@ For `identifier` fields, the permalink URL of the external record. It must conta For `identifier` fields, the regular expression that valid values are expected to match to be linkable. +##### `icons` + +For combo fields, the `icons` object might contain the name of icons which represent the different values of the field. + +Combo field types can accept key-label pairs in the `options` value of the `strings` property. + +```js +{ + "key": "crossing:markings", + "type": "combo", + "label": "Crossing Markings", + "icons": { + "zebra": "iD-crossing_markings-zebra", + "lines": "iD-crossing_markings-lines", + … + } +} +``` + +##### `iconsCrossReferences` + +An optional property to reference to the icons of another field, indicated by using that field's name contained in brackets, like `{field}`. This is for example useful when there are multiple variants of fields for the same tag, which should all use the same icons. + + ## Contributing iD's [code of conduct](https://github.com/openstreetmap/iD/blob/release/CODE_OF_CONDUCT.md) and diff --git a/schemas/field.json b/schemas/field.json index 3970e88..251a379 100644 --- a/schemas/field.json +++ b/schemas/field.json @@ -244,6 +244,14 @@ "description": "The manner and context in which the field is used", "type": "string", "enum": ["preset", "changeset", "manual", "group"] + }, + "icons": { + "description": "For combo fields: Name of icons which represents different values of this field", + "type": "object" + }, + "iconsCrossReference": { + "description": "A field can reference icons of another by using that field's identifier contained in brackets, like {field}.", + "type": "string" } }, "additionalProperties": false,