Skip to content

Commit 0bd04f1

Browse files
authored
Fix code examples in custom fields documentation (#1931)
* Fine-tune user guide * Fix code examples
1 parent 41ab304 commit 0bd04f1

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

docusaurus/docs/dev-docs/custom-fields.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import CustomFieldRequiresPlugin from '/docs/snippets/custom-field-requires-plug
1111

1212
Custom fields extend Strapi’s capabilities by adding new types of fields to content-types and components. Once created or added to Strapi via plugins, custom fields can be used in the Content-Type Builder and Content Manager just like built-in fields.
1313

14-
The present documentation is intended for custom field creators: it describes which APIs and functions developers must use to create a new custom field. The [user guide](/user-docs/plugins/introduction-to-plugins.md#custom-fields) describes how to add and use custom fields from Strapi's admin panel.
14+
The present documentation is intended for custom field creators: it describes which APIs and functions developers must use to create a new custom field. The [User Guide](/user-docs/plugins/introduction-to-plugins.md#custom-fields) describes how to add and use custom fields from Strapi's admin panel.
1515

1616
It is recommended that you develop a dedicated [plugin](/dev-docs/plugins-development) for custom fields. Custom field plugins include both a server and admin panel part. The custom field must be registered in both parts before it is usable in Strapi's admin panel.
1717

@@ -148,7 +148,7 @@ export default {
148148
components: {
149149
Input: async () =>
150150
import(
151-
/* webpackChunkName: "input-component" */ "./admin/src/components/Input"
151+
/* webpackChunkName: "input-component" */ "./components/Input"
152152
),
153153
},
154154
options: {
@@ -219,7 +219,7 @@ import * as React from "react";
219219

220220
import { useIntl } from "react-intl";
221221

222-
export const Input = React.forwardRef((props, ref) => {
222+
const Input = React.forwardRef((props, ref) => {
223223
const { attribute, disabled, intlLabel, name, onChange, required, value } =
224224
props; // these are just some of the props passed by the content-manager
225225

@@ -233,7 +233,7 @@ export const Input = React.forwardRef((props, ref) => {
233233

234234
return (
235235
<label>
236-
{intlLabel}
236+
{formatMessage(intlLabel)}
237237
<input
238238
ref={ref}
239239
name={name}
@@ -245,6 +245,8 @@ export const Input = React.forwardRef((props, ref) => {
245245
</label>
246246
);
247247
});
248+
249+
export default Input;
248250
```
249251

250252
</details>

docusaurus/docs/user-docs/plugins/introduction-to-plugins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ Currently, the only plugins designed to work with providers are the:
4242

4343
## Custom fields
4444

45-
Some plugins can add _custom fields_ to Strapi. Custom fields are a way to extend Strapi’s capabilities by adding new types of fields to content-types or components.
45+
Some plugins can add custom fields to Strapi (for additional information about creating custom fields plugins, see [Developer Docs](/dev-docs/custom-fields)). Custom fields are a way to extend Strapi’s capabilities by adding new types of fields to content-types or components.
4646

4747
Once added to Strapi (see [Marketplace](./installing-plugins-via-marketplace.md)), custom fields can be created in the [Content-type Builder](/user-docs/content-type-builder/configuring-fields-content-type#custom-fields) and used in the [Content Manager](/user-docs/content-manager/writing-content/).

0 commit comments

Comments
 (0)