69 public static function setFilter($blockId, array &$sourceParams = [])
73 foreach ($sourceParams as $selector => &$item)
75 $item[
'filterId'] = 0;
76 if (isset($item[
'source']))
78 $sourceId = trim($item[
'source']);
79 $sourceFilter = isset($item[
'settings'][
'source'][
'filter'])
80 ? $item[
'settings'][
'source'][
'filter']
83 $source = $sourceList->getDataLoader(
87 if (!is_object($source))
92 $sourceFilter = $source->normalizeFilter(
95 $hashFilter = $source->getFilterHash(
100 $res = self::getList([
105 '=FILTER_HASH' => $hashFilter
108 if ($row = $res->fetch())
110 $filterId = $row[
'ID'];
115 'SOURCE_ID' => $sourceId,
116 'FILTER_HASH' => $hashFilter,
117 'FILTER' => $sourceFilter
119 if ($res->isSuccess())
121 $filterId = $res->getId();
127 $item[
'filterId'] = $filterId;
129 unset($sourceFilter, $hashFilter, $res, $row);
132 unset($sourceList, $selector, $item);