136 $filterOption = new \Bitrix\Main\UI\Filter\Options(self::TABLE_ID);
137 $filterData = $filterOption->getFilter($filterFields);
138 $filterable = array();
139 $quickSearchKey =
'';
140 foreach ($filterFields as $filterField)
142 if (isset($filterField[
'quickSearch']))
144 $quickSearchKey = $filterField[
'quickSearch'].$filterField[
'id'];
146 $filterable[$filterField[
'id']] = $filterField[
'filterable'];
149 foreach ($filterData as $fieldId => $fieldValue)
151 if ((is_array($fieldValue) && empty($fieldValue)) || (is_string($fieldValue) && $fieldValue ==
''))
156 if (mb_substr($fieldId, -5) ===
'_from')
158 $realFieldId = mb_substr($fieldId, 0, -5);
159 if (!array_key_exists($realFieldId, $filterable))
163 if (mb_substr($realFieldId, -2) ===
'_1')
165 $newFilter[$realFieldId] = $fieldValue;
169 if (!empty($filterData[$realFieldId.
'_numsel']) && $filterData[$realFieldId.
'_numsel'] ===
'more')
172 $filterPrefix =
'>=';
173 $newFilter[$filterPrefix.$realFieldId] = trim($fieldValue);
176 elseif (mb_substr($fieldId, -3) ===
'_to')
178 $realFieldId = mb_substr($fieldId, 0, -3);
179 if (!array_key_exists($realFieldId, $filterable))
183 if (mb_substr($realFieldId, -2) ===
'_1')
185 $realFieldId = mb_substr($realFieldId, 0, -2);
186 $newFilter[$realFieldId.
'_2'] = $fieldValue;
190 if (!empty($filterData[$realFieldId.
'_numsel']) && $filterData[$realFieldId.
'_numsel'] ===
'less')
196 $filterPrefix =
'<=';
198 $newFilter[$filterPrefix.$realFieldId] = trim($fieldValue);
203 if (array_key_exists($fieldId, $filterable))
205 $filterPrefix = $filterable[$fieldId];
206 $newFilter[$filterPrefix.$fieldId] = $fieldValue;
208 if ($quickSearchKey && $fieldId ===
'FIND' && trim($fieldValue))
210 $newFilter[$quickSearchKey] = $fieldValue;