From aa87e60f10d23aadee2b0226faf4a7153e9e416b Mon Sep 17 00:00:00 2001 From: nathangray Date: Thu, 5 Mar 2020 15:37:42 -0700 Subject: [PATCH] Etemplate: Fix customfield widget bug "Cannot read property ... of undefined" --- api/js/etemplate/et2_extension_customfields.js | 3 ++- api/js/etemplate/et2_extension_customfields.ts | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/api/js/etemplate/et2_extension_customfields.js b/api/js/etemplate/et2_extension_customfields.js index 3d962749f6..603d3c24d1 100644 --- a/api/js/etemplate/et2_extension_customfields.js +++ b/api/js/etemplate/et2_extension_customfields.js @@ -196,8 +196,9 @@ var et2_customfields_list = /** @class */ (function (_super) { if (['select', 'radio', 'radiogroup', 'checkbox', 'button'].indexOf(field.type) == -1 && !jQuery.isEmptyObject(field.values)) { var w = et2_registry[attrs.type ? attrs.type : field.type]; 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]; + } } } // Create widget diff --git a/api/js/etemplate/et2_extension_customfields.ts b/api/js/etemplate/et2_extension_customfields.ts index a7087a37b4..e7ca1f0d55 100644 --- a/api/js/etemplate/et2_extension_customfields.ts +++ b/api/js/etemplate/et2_extension_customfields.ts @@ -272,8 +272,10 @@ export class et2_customfields_list extends et2_valueWidget implements et2_IDetac const w = et2_registry[attrs.type ? attrs.type : field.type]; for(let attr_name in field.values) { - if (typeof w.prototype.attributes[attr_name] != "undefined") - attrs[attr_name] = field.values[attr_name]; + if (typeof w._attributes[attr_name] != "undefined") + { + attrs[attr_name] = field.values[attr_name]; + } } } // Create widget