- Модуль: iblock
- Путь к файлу: ~/bitrix/modules/iblock/lib/model/propertyfeature.php
- Класс: BitrixIblockModelPropertyFeature
- Вызов: PropertyFeature::getFilteredPropertyCodes
static function getFilteredPropertyCodes(int $iblockId, array $filter, array $parameters = []): ?array
{
if (MainConfigOption::get('iblock', 'property_features_enabled') !== 'Y')
{
return null;
}
if ($iblockId <= 0)
{
return null;
}
if (!isset($filter['=MODULE_ID']) || !isset($filter['=FEATURE_ID']))
{
return null;
}
$getCode = (isset($parameters['CODE']) && $parameters['CODE'] == 'Y');
$result = [];
$filter['=PROPERTY.IBLOCK_ID'] = $iblockId;
$filter['=PROPERTY.ACTIVE'] = 'Y';
$filter['=IS_ENABLED'] = 'Y';
$iterator = IblockPropertyFeatureTable::getList([
'select' => [
'IBLOCK_PROPERTY_ID' => 'PROPERTY.ID',
'IBLOCK_PROPERTY_CODE' => 'PROPERTY.CODE',
'IBLOCK_PROPERTY_SORT' => 'PROPERTY.SORT',
],
'filter' => $filter,
'order' => [
'IBLOCK_PROPERTY_SORT' => 'ASC',
'IBLOCK_PROPERTY_ID' => 'ASC',
],
]);
while ($row = $iterator->fetch())
{
$result[(int)$row['IBLOCK_PROPERTY_ID']] = self::getPropertyCode(
[
'ID' => $row['IBLOCK_PROPERTY_ID'],
'CODE' => $row['IBLOCK_PROPERTY_CODE']
],
$getCode
);
}
unset($row, $iterator);
unset($filter, $getCode);
return (!empty($result) ? array_values($result) : null);
}