File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33namespace Loki \AdminComponents \Component \Grid ;
44
5+ use Magento \Framework \Data \OptionSourceInterface ;
56use Magento \Framework \DataObject ;
67use Magento \Framework \Model \ResourceModel \Db \AbstractDb ;
78use Magento \Framework \ObjectManagerInterface ;
@@ -271,16 +272,20 @@ public function getFilterFields(): array
271272
272273 $ fields = [];
273274 foreach ($ filters as $ filterCode => $ filter ) {
274- $ field = $ this ->fieldFactory ->createWithBlock (
275- $ filter ['field_type ' ],
276- $ filter ['label ' ],
277- $ filterCode ,
278- );
275+ $ filter ['code ' ] = $ filterCode ;
279276
280- if (isset ($ filter ['options ' ]) && is_string ( $ filter ['options ' ]) ) {
277+ if (isset ($ filter ['options ' ]) && false === $ filter ['options ' ] instanceof OptionSourceInterface ) {
281278 $ filter ['options ' ] = $ this ->objectManager ->get ($ filter ['options ' ]);
282279 }
283280
281+ if (isset ($ filter ['options ' ]) && false === $ filter ['options ' ] instanceof OptionSourceInterface) {
282+ throw new \RuntimeException ('Filter uses wrong options class ' );
283+ }
284+
285+ $ field = $ this ->fieldFactory ->createWithBlock (
286+ $ filter ,
287+ );
288+
284289 $ field ->getBlock ()->addData ($ filter );
285290 $ field ->getBlock ()->setField ($ field );
286291 $ fields [] = $ field ;
You can’t perform that action at this time.
0 commit comments