Etemplate: Fix customfield widget bug "Cannot read property ... of undefined"

This commit is contained in:
nathangray 2020-03-05 15:37:42 -07:00
parent 9b2e6b5012
commit aa87e60f10
2 changed files with 6 additions and 3 deletions

View File

@ -196,10 +196,11 @@ var et2_customfields_list = /** @class */ (function (_super) {
if (['select', 'radio', 'radiogroup', 'checkbox', 'button'].indexOf(field.type) == -1 && !jQuery.isEmptyObject(field.values)) { if (['select', 'radio', 'radiogroup', 'checkbox', 'button'].indexOf(field.type) == -1 && !jQuery.isEmptyObject(field.values)) {
var w = et2_registry[attrs.type ? attrs.type : field.type]; var w = et2_registry[attrs.type ? attrs.type : field.type];
for (var attr_name in field.values) { for (var attr_name in field.values) {
if (typeof w.prototype.attributes[attr_name] != "undefined") if (typeof w._attributes[attr_name] != "undefined") {
attrs[attr_name] = field.values[attr_name]; attrs[attr_name] = field.values[attr_name];
} }
} }
}
// Create widget // Create widget
var widget = this.widgets[field_name] = et2_createWidget(attrs.type ? attrs.type : field.type, attrs, this); var widget = this.widgets[field_name] = et2_createWidget(attrs.type ? attrs.type : field.type, attrs, this);
} }

View File

@ -272,10 +272,12 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac
const w = et2_registry[attrs.type ? attrs.type : field.type]; const w = et2_registry[attrs.type ? attrs.type : field.type];
for(let attr_name in field.values) for(let attr_name in field.values)
{ {
if (typeof w.prototype.attributes[attr_name] != "undefined") if (typeof w._attributes[attr_name] != "undefined")
{
attrs[attr_name] = field.values[attr_name]; attrs[attr_name] = field.values[attr_name];
} }
} }
}
// Create widget // Create widget
const widget = this.widgets[field_name] = et2_createWidget(attrs.type ? attrs.type : field.type, attrs, this); const widget = this.widgets[field_name] = et2_createWidget(attrs.type ? attrs.type : field.type, attrs, this);
} }