Previous the code caused the following error: `Uncaught TypeError: Cannot set property '1' of undefined` since it tries to set the language's value in an object which doesn't exist (yet).
const values = LanguageInput.getValues(this._fieldId);
if (values.size > 1) {
+ if (!Object.prototype.hasOwnProperty.call(data, this._fieldId + "_i18n")) {
+ data[this._fieldId + "_i18n"] = {};
+ }
+
values.forEach((value, key) => {
data[this._fieldId + "_i18n"][key] = value;
});
const data = {};
const values = LanguageInput.getValues(this._fieldId);
if (values.size > 1) {
+ if (!Object.prototype.hasOwnProperty.call(data, this._fieldId + "_i18n")) {
+ data[this._fieldId + "_i18n"] = {};
+ }
values.forEach((value, key) => {
data[this._fieldId + "_i18n"][key] = value;
});