- Модуль: iblock
- Путь к файлу: ~/bitrix/modules/iblock/lib/component/tools.php
- Класс: BitrixIblockComponentTools
- Вызов: Tools::isCheckboxProperty
static function isCheckboxProperty(array $property): bool
{
$propertyId = (int)($property['ID'] ?? 0);
if ($propertyId <= 0)
{
return false;
}
if (!isset(self::$checkboxPropertyCache[$propertyId]))
{
$result = false;
if (
($property['PROPERTY_TYPE'] ?? '') === PropertyTable::TYPE_LIST
&& ($property['MULTIPLE'] ?? '') === 'N'
&& (string)($property['USER_TYPE'] ?? '') === ''
&& ($property['LIST_TYPE'] ?? '') === PropertyTable::CHECKBOX
)
{
$filter = [
'=PROPERTY_ID' => $propertyId,
];
$cache = [
'ttl' => 86400,
];
if (PropertyEnumerationTable::getCount($filter, $cache) === 1)
{
$variant = PropertyEnumerationTable::getRow([
'select' => [
'ID',
'PROPERTY_ID',
'VALUE',
],
'filter' => $filter,
'cache' => $cache,
]);
if (($variant['VALUE'] ?? '') === self::CHECKBOX_VALUE_YES)
{
$result = true;
}
}
}
self::$checkboxPropertyCache[$propertyId] = $result;
}
return self::$checkboxPropertyCache[$propertyId];
}