• Модуль: iblock
  • Путь к файлу: ~/bitrix/modules/iblock/lib/component/base.php
  • Класс: BitrixIblockComponentBase
  • Вызов: Base::parseCondition
protected function parseCondition($condition, $params)
{
	$result = array();

	if (!empty($condition) && is_array($condition))
	{
		if ($condition['CLASS_ID'] === 'CondGroup')
		{
			if (!empty($condition['CHILDREN']))
			{
				foreach ($condition['CHILDREN'] as $child)
				{
					$childResult = $this->parseCondition($child, $params);

					// is group
					if ($child['CLASS_ID'] === 'CondGroup')
					{
						$result[] = $childResult;
					}
					// same property names not overrides each other
					elseif (isset($result[key($childResult)]))
					{
						$fieldName = key($childResult);

						if (!isset($result['LOGIC']))
						{
							$result = array(
								'LOGIC' => $condition['DATA']['All'],
								array($fieldName => $result[$fieldName])
							);
						}

						$result[][$fieldName] = $childResult[$fieldName];
					}
					else
					{
						$result += $childResult;
					}
				}

				if (!empty($result))
				{
					$this->parsePropertyCondition($result, $condition, $params);

					if (count($result) > 1)
					{
						$result['LOGIC'] = $condition['DATA']['All'];
					}
				}
			}
		}
		else
		{
			$result += $this->parseConditionLevel($condition, $params);
		}
	}

	return $result;
}