From ee5a224660d3cc5ad4e8638490cac406464b337f Mon Sep 17 00:00:00 2001 From: Rob Gietema Date: Tue, 17 Dec 2024 16:19:18 -0700 Subject: [PATCH] Fix modal title in schemawidget. --- .../components/manage/Widgets/SchemaWidget.jsx | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/packages/volto/src/components/manage/Widgets/SchemaWidget.jsx b/packages/volto/src/components/manage/Widgets/SchemaWidget.jsx index fe2b88785a..2f99018819 100644 --- a/packages/volto/src/components/manage/Widgets/SchemaWidget.jsx +++ b/packages/volto/src/components/manage/Widgets/SchemaWidget.jsx @@ -1500,13 +1500,21 @@ class SchemaWidget extends Component { const choices = [...this.props.fields, ...this.props.additionalFactory]; let editFieldType = ''; if (this.state.editField) { + let factory = + this.props.value.properties[this.state.editField.id].factory; + + if (factory.value) { + factory = factory.value; + } const fieldType = find(choices, { - value: this.props.value.properties[this.state.editField.id].factory, - }); - editFieldType = this.props.intl.formatMessage({ - id: fieldType.value, - defaultMessage: fieldType.label, + value: factory !== '' ? factory : 'label_text_field', }); + editFieldType = fieldType + ? this.props.intl.formatMessage({ + id: fieldType.value, + defaultMessage: fieldType.label, + }) + : ''; } const nonUserCreatedFields = this.props.value.fieldsets[ this.state.currentFieldset