fixes https://github.com/payloadcms/payload/issues/8455 and https://github.com/payloadcms/payload/issues/8462 - Builds the `_locale` column for the `_rels` when it's inside of a localized group / tab - Properly builds `sanitizedPath` for blocks in the transform-read function when it's inside of a localized field. This fixes with fields inside that have its own table (like `_rels`, select `hasMany: true` etc) Adds _more_ tests!
87 lines
1.9 KiB
TypeScript
87 lines
1.9 KiB
TypeScript
import type { CollectionConfig } from 'payload'
|
|
|
|
export const NestedFields: CollectionConfig = {
|
|
slug: 'nested-field-tables',
|
|
fields: [
|
|
{
|
|
name: 'array',
|
|
type: 'array',
|
|
localized: true,
|
|
fields: [
|
|
{
|
|
name: 'relation',
|
|
type: 'relationship',
|
|
relationTo: ['localized-posts'],
|
|
},
|
|
{
|
|
name: 'hasManyRelation',
|
|
type: 'relationship',
|
|
hasMany: true,
|
|
relationTo: 'localized-posts',
|
|
},
|
|
{
|
|
name: 'hasManyPolyRelation',
|
|
type: 'relationship',
|
|
hasMany: true,
|
|
relationTo: ['localized-posts'],
|
|
},
|
|
{
|
|
name: 'select',
|
|
type: 'select',
|
|
hasMany: true,
|
|
options: ['one', 'two', 'three'],
|
|
},
|
|
{
|
|
name: 'number',
|
|
type: 'number',
|
|
hasMany: true,
|
|
},
|
|
{
|
|
name: 'text',
|
|
type: 'text',
|
|
hasMany: true,
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: 'blocks',
|
|
type: 'blocks',
|
|
localized: true,
|
|
blocks: [
|
|
{
|
|
slug: 'block',
|
|
fields: [
|
|
{
|
|
name: 'nestedBlocks',
|
|
type: 'blocks',
|
|
blocks: [
|
|
{
|
|
slug: 'content',
|
|
fields: [
|
|
{
|
|
name: 'relation',
|
|
type: 'relationship',
|
|
relationTo: ['localized-posts'],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: 'array',
|
|
type: 'array',
|
|
fields: [
|
|
{
|
|
name: 'relation',
|
|
type: 'relationship',
|
|
relationTo: ['localized-posts'],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
}
|