Files
payload/test/localization/collections/NestedToArrayAndBlock/index.ts
Jessica Chowdhury 601759d967 feat: adds ability to copy data from across locales (#8203)
### What?

Adds ability to copy data from one locale to another at a document
level.

### How?

For any localized collection, you will find a new option in the document
controls called `Copy to Locale`.

This option will open a drawer, from here you can select your origin and
destination locales.

If data already exists in the destination locale, you can choose to: 
1. Overwrite this data (this will copy any empty fields in your origin
locale)
2. Not overwrite existing data (this will only copy data into empty
fields in the destination locale)

---------

Co-authored-by: Jarrod Flesch <jarrodmflesch@gmail.com>
2024-11-26 17:06:30 -05:00

52 lines
1.0 KiB
TypeScript

import type { CollectionConfig } from 'payload'
export const nestedToArrayAndBlockCollectionSlug = 'nested'
export const NestedToArrayAndBlock: CollectionConfig = {
slug: nestedToArrayAndBlockCollectionSlug,
fields: [
{
type: 'blocks',
name: 'blocks',
blocks: [
{
slug: 'block',
fields: [
{
name: 'array',
type: 'array',
fields: [
{
name: 'text',
type: 'text',
localized: true,
},
{
name: 'textNotLocalized',
type: 'text',
},
],
},
],
},
],
},
{
name: 'topLevelArray',
type: 'array',
localized: false,
fields: [
{
name: 'localizedText',
type: 'text',
localized: true,
},
{
name: 'notLocalizedText',
type: 'text',
},
],
},
],
}