Skip to content

Commit

Permalink
Clarify that server's plugin and admin's pluginId must match when def…
Browse files Browse the repository at this point in the history
…ining 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 <[email protected]>

---------

Co-authored-by: Pierre Wizla <[email protected]>
  • Loading branch information
tiagojsag and pwizla authored Oct 24, 2023
1 parent 3a544fc commit 4c8122d
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions docusaurus/docs/dev-docs/custom-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`<br/><br/>(_optional_) | The name of the plugin creating the custom fields | `String` |
| `type` | The data type the custom field will use | `String` |
| `inputSize`<br/><br/>(_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`<br/><br/>(_optional_) | The name of the plugin creating the custom fields<br/><br/>❗️ 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`<br/><br/>(_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:

Expand Down Expand Up @@ -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`<br/><br/>(_optional_) | Name of the plugin creating the custom field | `String` |
| `type` | Existing Strapi data type the custom field will use<br/><br/>❗️ Relations, media, components, or dynamic zones cannot be used. | `String` |
| `icon`<br/><br/>(_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`<br/><br/>(_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`<br/><br/>(_optional_) | Name of the plugin creating the custom field<br/><br/>❗️ 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<br/><br/>❗️ Relations, media, components, or dynamic zones cannot be used. | `String` |
| `icon`<br/><br/>(_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`<br/><br/>(_optional_) | Options to be used by the Content-type Builder (see [options](#options)) | `Object` |

<details>
<summary>Example: Registering an example "color" custom field in the admin panel:</summary>
Expand Down

1 comment on commit 4c8122d

@vercel
Copy link

@vercel vercel bot commented on 4c8122d Oct 24, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

documentation – ./

documentation-git-main-strapijs.vercel.app
documentation-strapijs.vercel.app
docs-vercel-v4.strapi.io

Please sign in to comment.