• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/discount/preset/manager.php
  • Класс: BitrixSaleDiscountPresetManager
  • Вызов: Manager::buildCustomPresets
private function buildCustomPresets()
{
	$presetList = array();

	$event = new Event('sale', 'OnSaleDiscountPresetBuildList');
	$event->send();

	foreach($event->getResults() as $evenResult)
	{
		if($evenResult->getType() != EventResult::SUCCESS)
		{
			continue;
		}

		$result = $evenResult->getParameters();
		if(!is_array($result))
		{
			throw new SystemException('Wrong event result by building preset list. Must be array.');
		}

		foreach($result as $preset)
		{
			if(empty($preset['CLASS']))
			{
				throw new SystemException('Wrong event result by building preset list. Could not find CLASS.');
			}

			if(is_string($preset['CLASS']) && class_exists($preset['CLASS']))
			{
				$preset = $this->createPresetInstance($preset['CLASS']);
				if($preset)
				{
					$presetList[] = $preset;
				}
			}
			else
			{
				throw new SystemException("Wrong event result by building preset list. Could not find class by CLASS {$preset['CLASS']}");
			}
		}
	}

	return $presetList;
}