File tree Expand file tree Collapse file tree 3 files changed +15
-11
lines changed
packages/plugin-nested-docs/src Expand file tree Collapse file tree 3 files changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -129,10 +129,11 @@ nestedDocsPlugin({
129
129
130
130
The function takes two arguments and returns a string:
131
131
132
- | Argument | Type | Description |
133
- | -------- | -------- | -------------------------------------------- |
134
- | ` docs ` | ` Array ` | An array of the breadcrumbs up to that point |
135
- | ` doc ` | ` Object ` | The current document being edited |
132
+ | Argument | Type | Description |
133
+ | ------------ | -------- | --------------------------------------------- |
134
+ | ` docs ` | ` Array ` | An array of the breadcrumbs up to that point |
135
+ | ` doc ` | ` Object ` | The current document being edited |
136
+ | ` collection ` | ` Object ` | The collection config of the current document |
136
137
137
138
#### ` generateURL `
138
139
@@ -148,10 +149,11 @@ nestedDocsPlugin({
148
149
})
149
150
```
150
151
151
- | Argument | Type | Description |
152
- | -------- | -------- | -------------------------------------------- |
153
- | ` docs ` | ` Array ` | An array of the breadcrumbs up to that point |
154
- | ` doc ` | ` Object ` | The current document being edited |
152
+ | Argument | Type | Description |
153
+ | ------------ | -------- | --------------------------------------------- |
154
+ | ` docs ` | ` Array ` | An array of the breadcrumbs up to that point |
155
+ | ` doc ` | ` Object ` | The current document being edited |
156
+ | ` collection ` | ` Object ` | The collection config of the current document |
155
157
156
158
#### ` parentFieldSlug `
157
159
Original file line number Diff line number Diff line change 1
- import type { CollectionSlug } from 'payload'
1
+ import type { CollectionSlug , SanitizedCollectionConfig } from 'payload'
2
2
3
3
export type Breadcrumb = {
4
4
doc : string
@@ -9,11 +9,13 @@ export type Breadcrumb = {
9
9
export type GenerateURL = (
10
10
docs : Array < Record < string , unknown > > ,
11
11
currentDoc : Record < string , unknown > ,
12
+ collection : SanitizedCollectionConfig ,
12
13
) => string
13
14
14
15
export type GenerateLabel = (
15
16
docs : Array < Record < string , unknown > > ,
16
17
currentDoc : Record < string , unknown > ,
18
+ collection : SanitizedCollectionConfig ,
17
19
) => string
18
20
19
21
export type NestedDocsPluginConfig = {
Original file line number Diff line number Diff line change @@ -27,11 +27,11 @@ export const formatBreadcrumb = ({
27
27
const lastDoc = docs [ docs . length - 1 ] !
28
28
29
29
if ( typeof generateURL === 'function' ) {
30
- url = generateURL ( docs , lastDoc )
30
+ url = generateURL ( docs , lastDoc , collection )
31
31
}
32
32
33
33
if ( typeof generateLabel === 'function' ) {
34
- label = generateLabel ( docs , lastDoc )
34
+ label = generateLabel ( docs , lastDoc , collection )
35
35
} else {
36
36
const title = collection . admin ?. useAsTitle ? lastDoc [ collection . admin . useAsTitle ] : ''
37
37
You can’t perform that action at this time.
0 commit comments