Badge::addAction

  1. Bitrix24 API (v. 23.675.0)
  2. crm
  3. Badge
  4. addAction
  • Модуль: crm
  • Путь к файлу: ~/bitrix/modules/crm/lib/controller/activity/badge.php
  • Класс: Bitrix\Crm\Controller\Activity\Badge
  • Вызов: Badge::addAction
public function addAction(string $code, $title, $value, string $type): ?array
{
	if (!$this->isAdmin())
	{
		$this->addError(ErrorCode::getAccessDeniedError());

		return null;
	}

	$this->validateTranslatedText($title, 'title');
	$this->validateTranslatedText($value, 'value');
	$this->validateType($type);
	if (!empty($this->getErrors()))
	{
		return null;
	}

	$result = $this->badgeTable::add([
		'CODE' => $code,
		'TITLE' => $title,
		'VALUE' => $value,
		'TYPE' => $type,
	]);

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

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

	return null;
}

Добавить комментарий