Nested Multi Label
Learn how to configure labels for nested arrays and objects using the `FieldLabel` decorator with `property`, `nested`, and `type` options for arrays of objects and multi-language translations.
Overview
Use Case 1: Array of Objects with i18n Labels
Scenario
Configuration
import { FieldLabel } from '@tradinos/cms-backend-entity';
import { I18nTranslations } from 'src/generated/i18n.generated';
@ApiProperty({ type: TaskDTO, isArray: true })
@Type(() => TaskDTO)
@FieldLabel<TaskDTO, I18nTranslations>({
property: "title", // The property to use for editing/display
type: "editable", // Makes the field editable
label: "labels.project.tasks", // Label for the array (plural)
nested: "labels.project.task" // Label for each item (singular)
})
tasks: TaskDTO[];Example from Codebase
Parameters Explained
Parameter
Type
Description
Required
How it Works
i18n Translation Files
Use Case 2: Multi-Language Array with Direct Values
Scenario
Configuration
Example from Codebase
Parameters Explained
Parameter
Type
Description
Required
How it Works
Data Structure
Use Case 3: Nested Object with Editable Property
Scenario
Configuration
Example from Codebase
Parameters Explained
Parameter
Type
Description
Required
Complete Examples
Example 1: Tasks Array (Full Implementation)
Example 2: Translations Array (Full Implementation)
Comparison Table
Best Practices
Common Patterns
Pattern 1: Array of Objects with Singular/Plural Labels
Pattern 2: Multi-Language Translations
Pattern 3: Nested Object with Display Property
Related Documentation
Summary
Last updated