• Модуль: landing
  • Путь к файлу: ~/bitrix/modules/landing/lib/publicaction/history.php
  • Класс: BitrixLandingPublicActionHistory
  • Вызов: History::clearForEntity
static function clearForEntity(string $entityType, int $entityId): PublicActionResult
{
	$result = new PublicActionResult();
	$error = new BitrixLandingError;

	LandingLanding::setEditMode(true);

	if (in_array($entityType, LandingHistory::AVAILABLE_TYPES))
	{
		$history = new LandingHistory($entityId, $entityType);
		if ($history->clear())
		{
			$result->setResult(true);
		}
		else
		{
			$error->addError(
				'HISTORY_CLEAR_ERROR',
				"History operation Clear fail for entity {$entityType}_{$entityId}"
			);
			$result->setError($error);
		}
	}
	else
	{
		$error->addError(
			'HISTORY_WRONG_TYPE',
			'Wrong history entity type'
		);
		$result->setError($error);
	}

	return $result;
}