• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/ads/adsform.php
  • Класс: Bitrix\Crm\Ads\AdsForm
  • Вызов: AdsForm::getForms
static function getForms($type, $accountId = null)
{
	$result = array();
	$form = static::getService()->getForm($type);
	$form->setAccountId($accountId);
	$formResult = $form->getList();

	if ($formResult->isSuccess())
	{
		/**@var array $formData */
		while ($formData = $formResult->fetch())
		{
			$formData = $form::normalizeListRow($formData);
			if ($formData['ID'])
			{
				$result[] = array(
					'id' => $formData['ID'],
					'name' => $formData['NAME'] ? : $formData['ID']
				);
			}
		}
	}
	else
	{
		self::$errors = $formResult->getErrorMessages();
	}

	return $result;
}