• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/integration/ui/entityselector/tasktemplateprovider.php
  • Класс: BitrixTasksIntegrationUIEntitySelectorTaskTemplateProvider
  • Вызов: TaskTemplateProvider::fillWithRecentItems
private function fillWithRecentItems(Dialog $dialog): void
{
	if ($dialog->getRecentItems()->count() <= 0)
	{
		return;
	}

	$templates = $this->getTemplates(['ids' => $this->getRecentItemsIds($dialog)]);
	foreach ($dialog->getRecentItems()->getAll() as $item)
	{
		/** @var RecentItem $item */
		$itemId = $item->getId();

		if (
			!array_key_exists($itemId, $templates)
			|| $dialog->getItemCollection()->get(static::ENTITY_ID, $itemId)
		)
		{
			continue;
		}

		$dialog->addItem(
			new Item([
				'entityId' => static::ENTITY_ID,
				'id' => $itemId,
				'title' => $templates[$itemId],
				'tabs' => 'recents',
			])
		);

		if ($dialog->getItemCollection()->count() >= static::ENTITY_ID)
		{
			break;
		}
	}
}