Skip to content

Commit 4477e90

Browse files
authored
feat: [EXT-3265] Add field name prop (#1527)
* feat: add field name prop * fix: name field
1 parent c579a2a commit 4477e90

File tree

4 files changed

+11
-0
lines changed

4 files changed

+11
-0
lines changed

lib/field-locale.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { ValidationError } from './types/validation-error'
55

66
export default class FieldLocale implements FieldAPI {
77
id: string
8+
name: string
89
locale: string
910
type: string
1011
required: boolean
@@ -19,6 +20,7 @@ export default class FieldLocale implements FieldAPI {
1920

2021
constructor(channel: Channel, info: FieldInfo) {
2122
this.id = info.id
23+
this.name = info.name
2224
this.locale = info.locale
2325
this.type = info.type
2426
this.required = info.required

lib/field.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export default class Field implements EntryFieldAPI {
66
private _defaultLocale: string
77
private _fieldLocales: { [key: string]: FieldLocale }
88
id: string
9+
name: string
910
locales: string[]
1011
type: string
1112
required: boolean
@@ -14,6 +15,7 @@ export default class Field implements EntryFieldAPI {
1415

1516
constructor(channel: Channel, info: EntryFieldInfo, defaultLocale: string) {
1617
this.id = info.id
18+
this.name = info.name
1719
this.locales = info.locales
1820
this.type = info.type
1921
this.required = info.required
@@ -26,6 +28,7 @@ export default class Field implements EntryFieldAPI {
2628
(acc: { [key: string]: FieldLocale }, locale: string) => {
2729
const fieldLocale = new FieldLocale(channel, {
2830
id: info.id,
31+
name: info.name,
2932
type: info.type,
3033
required: info.required,
3134
validations: info.validations,

lib/types/field-locale.types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import { ValidationError } from './validation-error'
55
export interface FieldAPI {
66
/** The ID of a field is defined in an entry's content type. */
77
id: string
8+
/** The name of the field */
9+
name: string
810
/** The current locale of a field the app is attached to. */
911
locale: string
1012
/** Holds the type of the field the app is attached to. */

lib/types/field.types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { ValidationError } from './validation-error'
55

66
export interface FieldInfo {
77
id: string
8+
name: string
89
locale: string
910
type: string
1011
required: boolean
@@ -17,6 +18,7 @@ export interface FieldInfo {
1718

1819
export interface EntryFieldInfo {
1920
id: string
21+
name: string
2022
locales: string[]
2123
type: string
2224
required: boolean
@@ -30,6 +32,8 @@ export interface EntryFieldInfo {
3032
export interface EntryFieldAPI {
3133
/** The ID of a field is defined in an entry's content type. */
3234
id: string
35+
/** The name of the field */
36+
name: string
3337
/** The list of locales for the field. */
3438
locales: string[]
3539
/** Holds the type of the field. */

0 commit comments

Comments
 (0)