- Модуль: iblock
- Путь к файлу: ~/bitrix/modules/iblock/lib/component/base.php
- Класс: BitrixIblockComponentBase
- Вызов: Base::filterByParams
protected function filterByParams($ids, $filterIds = array(), $useSectionFilter = true)
{
if (empty($ids))
{
return array();
}
$ids = array_values(array_unique($ids));
// remove duplicates of already showed items
if (!empty($filterIds))
{
$ids = array_diff($ids, $filterIds);
}
if (!empty($ids))
{
$filter = $this->filterFields;
$filter['ID'] = $ids;
$correctIds = array();
$elementIterator = CIBlockElement::GetList(array(), $filter, false, false, array('ID'));
while ($element = $elementIterator->Fetch())
{
$correctIds[] = $element['ID'];
}
if ($useSectionFilter && !empty($correctIds) && $this->arParams['SHOW_FROM_SECTION'] === 'Y')
{
$correctIds = $this->filterIdBySection(
$correctIds,
$this->arParams['IBLOCK_ID'],
$this->arParams['SECTION_ID'],
$this->arParams['PAGE_ELEMENT_COUNT'],
$this->arParams['DEPTH']
);
}
$correctIds = array_flip($correctIds);
// remove invalid items
foreach ($ids as $key => $id)
{
if (!isset($correctIds[$id]))
{
unset($ids[$key]);
}
}
return array_values($ids);
}
else
{
return array();
}
}