From 4c8122daa23355c700d4226bf66f50fce048bcde Mon Sep 17 00:00:00 2001 From: Tiago Garcia Date: Tue, 24 Oct 2023 16:47:15 +0100 Subject: [PATCH] Clarify that server's plugin and admin's pluginId must match when defining a custom field in a plugin (#1890) * Clarify that server's plugin and admin's pluginId must match when defining a custom field in a plugin * Update docusaurus/docs/dev-docs/custom-fields.md Co-authored-by: Pierre Wizla --------- Co-authored-by: Pierre Wizla --- docusaurus/docs/dev-docs/custom-fields.md | 32 +++++++++++------------ 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/docusaurus/docs/dev-docs/custom-fields.md b/docusaurus/docs/dev-docs/custom-fields.md index 2dcf8a09a6..a0e52423e7 100644 --- a/docusaurus/docs/dev-docs/custom-fields.md +++ b/docusaurus/docs/dev-docs/custom-fields.md @@ -35,12 +35,12 @@ The `strapi.customFields` object exposes a `register()` method on the `Strapi` i `strapi.customFields.register()` registers one or several custom field(s) on the server by passing an object (or an array of objects) with the following parameters: -| Parameter | Description | Type | -| --------------------------------- | --------------------------------------------------------------------------- | -------- | -| `name` | The name of the custom field | `String` | -| `plugin`

(_optional_) | The name of the plugin creating the custom fields | `String` | -| `type` | The data type the custom field will use | `String` | -| `inputSize`

(_optional_) | Parameters to define the width of a custom field's input in the admin panel | `Object` | +| Parameter | Description | Type | +| --------------------------------- |---------------------------------------------------------------------------------------------------------------------------------------------------------| -------- | +| `name` | The name of the custom field | `String` | +| `plugin`

(_optional_) | The name of the plugin creating the custom fields

❗️ If defined, the `pluginId` value on the admin panel registration must have the same value (see [Registering a custom field in the admin panel](#registering-a-custom-field-in-the-admin-panel)) | `String` | +| `type` | The data type the custom field will use | `String` | +| `inputSize`

(_optional_) | Parameters to define the width of a custom field's input in the admin panel | `Object` | The optional `inputSize` object, when specified, must contain all of the following parameters: @@ -108,16 +108,16 @@ The `app.customFields` object exposes a `register()` method on the `StrapiApp` i `app.customFields.register()` registers one or several custom field(s) in the admin panel by passing an object (or an array of objects) with the following parameters: -| Parameter | Description | Type | -| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | -| `name` | Name of the custom field | `String` | -| `pluginId`

(_optional_) | Name of the plugin creating the custom field | `String` | -| `type` | Existing Strapi data type the custom field will use

❗️ Relations, media, components, or dynamic zones cannot be used. | `String` | -| `icon`

(_optional_) | Icon for the custom field | `React.ComponentType` | -| `intlLabel` | Translation for the name | [`IntlObject`](https://formatjs.io/docs/react-intl/) | -| `intlDescription` | Translation for the description | [`IntlObject`](https://formatjs.io/docs/react-intl/) | -| `components` | Components needed to display the custom field in the Content Manager (see [components](#components)) | -| `options`

(_optional_) | Options to be used by the Content-type Builder (see [options](#options)) | `Object` | +| Parameter | Description | Type | +| -------------------------------- |----------------------------------------------------------------------------------------------------------------------------------------------| ---------------------------------------------------- | +| `name` | Name of the custom field | `String` | +| `pluginId`

(_optional_) | Name of the plugin creating the custom field

❗️ If defined, the `plugin` value on the server registration must have the same value (see [Registering a custom field on the server](#registering-a-custom-field-on-the-server)) | `String` | +| `type` | Existing Strapi data type the custom field will use

❗️ Relations, media, components, or dynamic zones cannot be used. | `String` | +| `icon`

(_optional_) | Icon for the custom field | `React.ComponentType` | +| `intlLabel` | Translation for the name | [`IntlObject`](https://formatjs.io/docs/react-intl/) | +| `intlDescription` | Translation for the description | [`IntlObject`](https://formatjs.io/docs/react-intl/) | +| `components` | Components needed to display the custom field in the Content Manager (see [components](#components)) | +| `options`

(_optional_) | Options to be used by the Content-type Builder (see [options](#options)) | `Object` |
Example: Registering an example "color" custom field in the admin panel: