docs: improve examples in module link direction (#10590)
This commit is contained in:
@@ -38,12 +38,12 @@ The above links are two different links that serve different purposes.
|
|||||||
|
|
||||||
If you're adding a link to a data model to extend it and add new fields, define the link from the main data model to the custom data model.
|
If you're adding a link to a data model to extend it and add new fields, define the link from the main data model to the custom data model.
|
||||||
|
|
||||||
For example, if the `myCustom` data model adds new fields to the `product` data model, define the link from `product` to `myCustom`:
|
For example, consider you want to add a `subtitle` custom field to the `product` data model. To do that, you define a `Subtitle` data model in your module, then define a link from the `Product` data model to it:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
export default defineLink(
|
export default defineLink(
|
||||||
ProductModule.linkable.product,
|
ProductModule.linkable.product,
|
||||||
HelloModule.linkable.myCustom
|
HelloModule.linkable.subtitle
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -51,11 +51,11 @@ export default defineLink(
|
|||||||
|
|
||||||
If you're linking data models to indicate an association between them, define the link from the custom data model to the main data model.
|
If you're linking data models to indicate an association between them, define the link from the custom data model to the main data model.
|
||||||
|
|
||||||
For example, if the `myCustom` data model is associated to the `product` data model, define the link from `myCustom` to `product`:
|
For example, consider you have `Post` data model representing a blog post, and you want to associate a blog post with a product. To do that, define a link from the `Post` data model to `Product`:
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
export default defineLink(
|
export default defineLink(
|
||||||
HelloModule.linkable.myCustom,
|
HelloModule.linkable.post,
|
||||||
ProductModule.linkable.product
|
ProductModule.linkable.product
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ export const generatedEditDates = {
|
|||||||
"app/learn/debugging-and-testing/testing-tools/modules-tests/module-example/page.mdx": "2024-12-09T15:52:22.185Z",
|
"app/learn/debugging-and-testing/testing-tools/modules-tests/module-example/page.mdx": "2024-12-09T15:52:22.185Z",
|
||||||
"app/learn/debugging-and-testing/testing-tools/modules-tests/page.mdx": "2024-12-09T15:52:57.091Z",
|
"app/learn/debugging-and-testing/testing-tools/modules-tests/page.mdx": "2024-12-09T15:52:57.091Z",
|
||||||
"app/learn/fundamentals/module-links/custom-columns/page.mdx": "2024-11-20T14:32:09.764Z",
|
"app/learn/fundamentals/module-links/custom-columns/page.mdx": "2024-11-20T14:32:09.764Z",
|
||||||
"app/learn/fundamentals/module-links/directions/page.mdx": "2024-10-21T13:30:21.369Z",
|
"app/learn/fundamentals/module-links/directions/page.mdx": "2024-12-12T15:31:31.555Z",
|
||||||
"app/learn/fundamentals/module-links/page.mdx": "2024-12-09T14:39:26.668Z",
|
"app/learn/fundamentals/module-links/page.mdx": "2024-12-09T14:39:26.668Z",
|
||||||
"app/learn/fundamentals/module-links/query/page.mdx": "2024-12-09T15:54:44.798Z",
|
"app/learn/fundamentals/module-links/query/page.mdx": "2024-12-09T15:54:44.798Z",
|
||||||
"app/learn/fundamentals/module-links/remote-link/page.mdx": "2024-10-28T04:22:21.328Z",
|
"app/learn/fundamentals/module-links/remote-link/page.mdx": "2024-10-28T04:22:21.328Z",
|
||||||
|
|||||||
Reference in New Issue
Block a user