Tag::deleteFromTask

  1. Bitrix24 API (v. 23.675.0)
  2. tasks
  3. Tag
  4. deleteFromTask
  • Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/control/tag.php
  • Класс: BitrixTasksControlTag
  • Вызов: Tag::deleteFromTask
private function deleteFromTask(int $taskId, array $tagsForDelete): void
{
	if (empty($tagsForDelete))
	{
		return;
	}

	$forDelete = [];
	foreach ($tagsForDelete as $tag)
	{
		$forDelete[] = trim($tag['NAME']);
	}

	$this->cacheCurrentTags($taskId);
	$tags = self::$storage[self::TASK_TAGS_CACHE];

	$idList = [];
	foreach ($tags as $tag)
	{
		if (in_array($tag['NAME'], $forDelete, true))
		{
			$idList[] = $tag['ID'];
			TagAccessController::dropItemCache($tag['ID']);
		}
	}

	TaskTagTable::deleteList([
		'=TASK_ID' => $taskId,
		'@TAG_ID' => $idList,
	]);
}

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