Favorite::delete

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. Favorite
  4. delete
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/dispatcher/publicaction/task/favorite.php
  • Класс: Bitrix\Tasks\Dispatcher\PublicAction\Task\Favorite
  • Вызов: Favorite::delete
public function delete($taskId)
{
	$result = [];

	if (!TaskAccessController::can($this->userId, ActionDictionary::ACTION_TASK_READ, (int)$taskId))
	{
		$this->addForbiddenError();
		return $result;
	}

	try
	{
		if($taskId = $this->checkTaskId($taskId))
		{
			// user can add a task ONLY to his OWN favorite-list
			$task = new \CTaskItem($taskId, User::getId());
			$task->deleteFromFavorite();
		}
	}
	catch (\CTaskAssertException $e)
	{
		return $result;
	}

	return $result;
}

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