• Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/controller/timeline/logo.php
  • Класс: Bitrix\Crm\Controller\Timeline\Logo
  • Вызов: Logo::addAction
public function addAction(string $code, string $fileContent): ?array
{
	if (!$this->isAdmin())
	{
		$this->addError(ErrorCode::getAccessDeniedError());

		return null;
	}

	$fileId = $this->checkAndSaveFile($fileContent);

	if (!$fileId)
	{
		$this->addError(new Error('File not saved', 'FILE_SAVE_ERROR'));
		return null;
	}

	$result = $this->logoTable::add([
		'CODE' => $code,
		'FILE_ID' => $fileId,
	]);

	if ($result->isSuccess())
	{
		return [
			'logo' => $this->getLogoDataByCode($code),
		];
	}

	foreach ($result->getErrors() as $error)
	{
		$this->addError($error);
	}

	return null;
}