-
-
Save yasudacloud/7ac9caf5749f82e2f5391353faf1120e to your computer and use it in GitHub Desktop.
plugin/admin/src/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [plugin]/admin/src/index.tsx | |
import React from 'react'; | |
import pluginPkg from '../../package.json'; | |
import pluginId from './pluginId'; | |
import Initializer from './components/Initializer'; | |
const name = pluginPkg.strapi.name; | |
export default { | |
register(app) { | |
const options = { | |
name: "postcode", | |
pluginId: "ja-postcode", | |
type: "string", | |
intlLabel: { | |
id: "ja-postcode.postcode.label", | |
defaultMessage: "PostCode", | |
}, | |
intlDescription: { | |
id: "ja-postcode.postcode.description", | |
defaultMessage: "7-digit zip code", | |
}, | |
icon: null, | |
components: { | |
Input: async () => import("./components/PostCode"), | |
}, | |
options: { | |
base: [], | |
advanced: [ | |
{ | |
sectionTitle: { | |
id: 'global.settings', | |
defaultMessage: 'Settings', | |
}, | |
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', | |
}, | |
}, | |
], | |
}, | |
], | |
} | |
} | |
app.customFields.register(options) | |
const plugin = { | |
id: pluginId, | |
initializer: Initializer, | |
isReady: false, | |
name, | |
}; | |
app.registerPlugin(plugin); | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment