• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/classes/general/prop_section_auto.php
  • Класс: CIBlockPropertySectionAutoComplete
  • Вызов: CIBlockPropertySectionAutoComplete::AddFilterFields
static function AddFilterFields($arProperty, $strHTMLControlName, &$arFilter, &$filtered)
{
	$filtered = false;

	$arFilterValues = array();

	if (isset($strHTMLControlName["FILTER_ID"]))
	{
		$filterOption = new BitrixMainUIFilterOptions($strHTMLControlName["FILTER_ID"]);
		$filterData = $filterOption->getFilter();
		if (!empty($filterData[$strHTMLControlName["VALUE"]]))
		{
			$arFilterValues = (is_array($filterData[$strHTMLControlName["VALUE"]]) ?
				$filterData[$strHTMLControlName["VALUE"]] : array($filterData[$strHTMLControlName["VALUE"]]));
		}
	}
	else
	{
		if (isset($_REQUEST[$strHTMLControlName["VALUE"]]) && (is_array($_REQUEST[$strHTMLControlName["VALUE"]]) ||
			(0 < intval($_REQUEST[$strHTMLControlName["VALUE"]]))))
		{
			$arFilterValues = (is_array($_REQUEST[$strHTMLControlName["VALUE"]]) ?
				$_REQUEST[$strHTMLControlName["VALUE"]] : array($_REQUEST[$strHTMLControlName["VALUE"]]));
		}
		elseif (isset($GLOBALS[$strHTMLControlName["VALUE"]]) && (is_array($GLOBALS[$strHTMLControlName["VALUE"]]) ||
			(0 < intval($GLOBALS[$strHTMLControlName["VALUE"]]))))
		{
			$arFilterValues = (is_array($GLOBALS[$strHTMLControlName["VALUE"]]) ?
				$GLOBALS[$strHTMLControlName["VALUE"]] : array($GLOBALS[$strHTMLControlName["VALUE"]]));
		}
	}

	foreach ($arFilterValues as $key => $value)
	{
		if (0 >= intval($value))
			unset($arFilterValues[$key]);
	}

	if (!empty($arFilterValues))
	{
		$arFilter["=PROPERTY_".$arProperty["ID"]] = $arFilterValues;
		$filtered = true;
	}
}