Skip to content

Commit

Permalink
Fix code examples in custom fields documentation (#1931)
Browse files Browse the repository at this point in the history
* Fine-tune user guide

* Fix code examples
  • Loading branch information
pwizla authored Nov 29, 2023
1 parent 41ab304 commit 0bd04f1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions docusaurus/docs/dev-docs/custom-fields.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import CustomFieldRequiresPlugin from '/docs/snippets/custom-field-requires-plug

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.

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.
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.

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.

Expand Down Expand Up @@ -148,7 +148,7 @@ export default {
components: {
Input: async () =>
import(
/* webpackChunkName: "input-component" */ "./admin/src/components/Input"
/* webpackChunkName: "input-component" */ "./components/Input"
),
},
options: {
Expand Down Expand Up @@ -219,7 +219,7 @@ import * as React from "react";

import { useIntl } from "react-intl";

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

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

return (
<label>
{intlLabel}
{formatMessage(intlLabel)}
<input
ref={ref}
name={name}
Expand All @@ -245,6 +245,8 @@ export const Input = React.forwardRef((props, ref) => {
</label>
);
});

export default Input;
```

</details>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,6 @@ Currently, the only plugins designed to work with providers are the:

## Custom fields

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.
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.

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/).

1 comment on commit 0bd04f1

@vercel
Copy link

@vercel vercel bot commented on 0bd04f1 Nov 29, 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.