diff --git a/examples/getstarted/src/plugins/mycustomfields/admin/src/index.js b/examples/getstarted/src/plugins/mycustomfields/admin/src/index.js index 23c997cc0a..27005dbe71 100644 --- a/examples/getstarted/src/plugins/mycustomfields/admin/src/index.js +++ b/examples/getstarted/src/plugins/mycustomfields/admin/src/index.js @@ -5,131 +5,112 @@ import ColorPickerIcon from './components/ColorPicker/ColorPickerIcon'; export default { register(app) { - app.customFields.register([ - { - name: 'map', - pluginId: 'mycustomfields', - type: 'json', - intlLabel: { - id: 'mycustomfields.map.label', - defaultMessage: 'Map', - }, - intlDescription: { - id: 'mycustomfields.map.description', - defaultMessage: 'Select any location', - }, - components: { - Input: async () => - import(/* webpackChunkName: "input-component" */ './components/Map/MapInput'), - }, + app.customFields.register({ + name: 'color', + pluginId: 'mycustomfields', + type: 'string', + icon: ColorPickerIcon, + intlLabel: { + id: 'mycustomfields.color.label', + defaultMessage: 'Color', }, - { - name: 'color', - pluginId: 'mycustomfields', - type: 'string', - icon: ColorPickerIcon, - intlLabel: { - id: 'mycustomfields.color.label', - defaultMessage: 'Color', - }, - intlDescription: { - id: 'mycustomfields.color.description', - defaultMessage: 'Select any color', - }, - components: { - Input: async () => - import( - /* webpackChunkName: "input-component" */ './components/ColorPicker/ColorPickerInput' - ), - }, - options: { - base: [ - { - intlLabel: { - id: 'color-picker.color.format.label', - defaultMessage: 'Color format', - }, - name: 'options.format', - type: 'select', - value: 'hex', - options: [ - { - key: '__null_reset_value__', - value: '', - metadatas: { - intlLabel: { - id: 'color-picker.color.format.placeholder', - defaultMessage: 'Select a format', - }, - hidden: true, - }, - }, - { - key: 'hex', - value: 'hex', - metadatas: { - intlLabel: { - id: 'color-picker.color.format.hex', - defaultMessage: 'Hexadecimal', - }, - }, - }, - { - key: 'rgba', - value: 'rgba', - metadatas: { - intlLabel: { - id: 'color-picker.color.format.rgba', - defaultMessage: 'RGBA', - }, - }, - }, - ], + intlDescription: { + id: 'mycustomfields.color.description', + defaultMessage: 'Select any color', + }, + components: { + Input: async () => + import( + /* webpackChunkName: "input-component" */ './components/ColorPicker/ColorPickerInput' + ), + }, + options: { + base: [ + { + intlLabel: { + id: 'color-picker.color.format.label', + defaultMessage: 'Color format', }, - ], - advanced: [ - { - sectionTitle: { - id: 'global.settings', - defaultMessage: 'Settings', + name: 'options.format', + type: 'select', + value: 'hex', + options: [ + { + key: '__null_reset_value__', + value: '', + metadatas: { + intlLabel: { + id: 'color-picker.color.format.placeholder', + defaultMessage: 'Select a format', + }, + hidden: true, + }, }, - items: [ - { - name: 'required', - type: 'checkbox', + { + key: 'hex', + value: 'hex', + metadatas: { intlLabel: { - id: 'form.attribute.item.requiredField', - defaultMessage: 'Required field', - }, - description: { - id: 'form.attribute.item.requiredField.description', - defaultMessage: "You won't be able to create an entry if this field is empty", + id: 'color-picker.color.format.hex', + defaultMessage: 'Hexadecimal', }, }, - { - name: 'private', - type: 'checkbox', + }, + { + key: 'rgba', + value: 'rgba', + metadatas: { intlLabel: { - id: 'form.attribute.item.privateField', - defaultMessage: 'Private field', - }, - description: { - id: 'form.attribute.item.privateField.description', - defaultMessage: 'This field will not show up in the API response', + id: 'color-picker.color.format.rgba', + defaultMessage: 'RGBA', }, }, - ], + }, + ], + }, + ], + advanced: [ + { + sectionTitle: { + id: 'global.settings', + defaultMessage: 'Settings', }, - ], - validator: (args) => ({ - format: yup.string().required({ - id: 'options.color-picker.format.error', - defaultMessage: 'The color format is required', - }), + items: [ + { + name: 'required', + type: 'checkbox', + intlLabel: { + id: 'form.attribute.item.requiredField', + defaultMessage: 'Required field', + }, + description: { + id: 'form.attribute.item.requiredField.description', + defaultMessage: "You won't be able to create an entry if this field is empty", + }, + }, + { + name: 'private', + type: 'checkbox', + intlLabel: { + id: 'form.attribute.item.privateField', + defaultMessage: 'Private field', + }, + description: { + id: 'form.attribute.item.privateField.description', + defaultMessage: 'This field will not show up in the API response', + }, + }, + ], + }, + ], + validator: (args) => ({ + format: yup.string().required({ + id: 'options.color-picker.format.error', + defaultMessage: 'The color format is required', }), - }, + }), }, - ]); + }); }, bootstrap(app) {}, async registerTrads({ locales }) {