fix: allow to set choices for a nullablechoices field (#2462)

fix #2380
This commit is contained in:
Yohan Boniface 2025-01-30 17:14:27 +01:00 committed by GitHub
commit be1fa55e9b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 5 deletions

View file

@ -1191,11 +1191,13 @@ Fields.TernaryChoices = class extends Fields.MultiChoice {
Fields.NullableChoices = class extends Fields.TernaryChoices { Fields.NullableChoices = class extends Fields.TernaryChoices {
getChoices() { getChoices() {
return [ return (
[true, translate('always')], this.properties.choices || [
[false, translate('never')], [true, translate('always')],
['null', translate('hidden')], [false, translate('never')],
] ['null', translate('hidden')],
]
)
} }
} }

View file

@ -447,6 +447,11 @@ export const SCHEMA = {
label: translate('Display label'), label: translate('Display label'),
inheritable: true, inheritable: true,
default: false, default: false,
choices: [
[true, translate('always')],
[false, translate('never')],
['null', translate('on hover')],
],
}, },
slideshow: { slideshow: {
type: Object, type: Object,