Reusing BaseElementField #64
-
I want to use I could access export default class FieldB extends BaseElementField
{
name = 'FieldB'
get schema () {
return {
fieldB: {
type: 'object',
schema: {
toggle: {
type: 'toggle',
label: 'Toggle',
floating: false,
},
fieldAData: {
...FileldA.prototype.schema.form;,
conditions: [
[`${this.section}.fieldB.toggle`, '==', true],
],
},
}
}
}
}
} But it seems not a good practice. |
Beta Was this translation helpful? Give feedback.
Answered by
adamberecz
Jun 18, 2024
Replies: 1 comment 2 replies
-
I would use this approach: export default class FieldA extends BaseElementField
{
name = 'FieldA'
get baseSchema () {
return {
fieldA: {
// ...
}
}
}
get schema () {
return this.baseSchema
}
}
export default class FieldB extends FieldA
{
name = 'FieldB'
get schema () {
const fieldASchema = this.baseSchema
return {
fieldB: {
// ...
}
}
}
} |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would take a different approach of using named exports for the
schema
of each field:// FieldC.js