pdaleramirez / super-filter

Other
6 stars 2 forks source link

Fix handling of sort option closures. #13

Closed gwillz closed 4 years ago

gwillz commented 4 years ago

SearchTypes::getSortOptions assumed that orderBy is always a string and breaks otherwise.

As documented in craft/base/ElementInterface:

orderBy – An array, comma-delimited string, or a callback function that defines the columns to order the query by. If set to a callback function, the function will be passed a single argument, $dir, set to either SORT_ASC or SORT_DESC, and it should return an array of column names or an [[\yii\db\ExpressionInterface]] object.

Yeah so we couldn't even create a 'search setup' without it breaking. So I just wrapped it up.

In testing the admin interface now works. I haven't gone much further than that.

pdaleramirez commented 4 years ago

@gwillz Thank you very much for your pull request. I hadn't notice that It was breaking on newer version of Craft.