Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[IndexBundle] fix index iterator interpreter #1076

Merged
merged 1 commit into from
Aug 28, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ coreshop.index.interpreters.iterator = Class.create(coreshop.index.interpreters.
return pimcore.globalmanager.get('coreshop_index_interpreters');
},

getClassItem: function() {
return coreshop.index.interpreters;
},

getForm: function (record, config) {
this.interpreterPanel = new Ext.form.FormPanel({
defaults: { anchor: '90%' },
Expand Down Expand Up @@ -77,39 +73,38 @@ coreshop.index.interpreters.iterator = Class.create(coreshop.index.interpreters.
getInterpreterPanelLayout : function (type, record, parentConfig, config) {
if (type) {
type = type.toLowerCase();
var classItem = this.getClassItem();

if (classItem[type]) {
this.interpreter = new classItem[type];
if (coreshop.index.interpreters[type]) {
this.interpreterPanelClass = new coreshop.index.interpreters[type];

this.interpreterPanel.add(this.interpreter.getForm(record, Ext.isObject(config) ? config : {}, parentConfig));
this.interpreterPanel.add(this.interpreterPanelClass.getForm(record, Ext.isObject(config) ? config : {}, parentConfig));
this.interpreterPanel.show();
} else {
this.interpreterPanel.hide();

this.interpreter = null;
this.interpreterPanelClass = null;
}
} else {
this.interpreterPanel.hide();
}
},

isValid: function() {
if (!this.interpreter) {
return false;
if (!this.interpreterPanelClass) {
return this.interpreterTypeCombo.getValue() ? true : false;
}

return this.interpreter.isValid();
return this.interpreterPanelClass.isValid();
},

getInterpreterData: function () {
// get defined conditions
if (this.interpreter) {
if (this.interpreterPanelClass) {
var interpreterConfig = {};
var interpreterForm = this.interpreterPanel.getForm();

if (Ext.isFunction(this.interpreter.getInterpreterData)) {
interpreterConfig = this.interpreter.getInterpreterData();
if (Ext.isFunction(this.interpreterPanelClass.getInterpreterData)) {
interpreterConfig = this.interpreterPanelClass.getInterpreterData();
}
else {
Ext.Object.each(interpreterForm.getFieldValues(), function (key, value) {
Expand All @@ -125,6 +120,10 @@ coreshop.index.interpreters.iterator = Class.create(coreshop.index.interpreters.
};
}

return {};
return {
interpreter: {
type: this.interpreterTypeCombo.getValue()
}
};
}
});