Skip to content

Commit

Permalink
Merge pull request #22170 from colemanw/fixSearchKitOptions
Browse files Browse the repository at this point in the history
SearchKit - Fix regression for pseudoconstant selection
  • Loading branch information
colemanw authored Nov 30, 2021
2 parents f7c2d10 + 860f724 commit 0961f3f
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ext/search_kit/ang/crmSearchAdmin/crmSearchClause.component.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,21 @@
}
}

this.getField = function(expr) {
// Gets the first arg of type "field"
function getFirstArgFromExpr(expr) {
if (!(expr in meta)) {
meta[expr] = _.findWhere(searchMeta.parseExpr(expr).args, {type: 'field'});
}
return meta[expr] && meta[expr].field;
return meta[expr] || {};
}

this.getField = function(expr) {
return getFirstArgFromExpr(expr).field;
};

this.getOptionKey = function(expr) {
var field = ctrl.getField(expr) || {};
return field.suffix ? field.suffix.slice(1) : 'id';
var arg = getFirstArgFromExpr(expr);
return arg.suffix ? arg.suffix.slice(1) : 'id';
};

this.addGroup = function(op) {
Expand Down

0 comments on commit 0961f3f

Please sign in to comment.