• Модуль: im
  • Путь к файлу: ~/bitrix/modules/im/lib/V2/Entity/Url/UrlCollection.php
  • Класс: BitrixImV2EntityUrlUrlCollection
  • Вызов: UrlCollection::initByPreviewUrlsIds
static function initByPreviewUrlsIds(array $previewUrlsIds, bool $withHtml = true): self
{
	$urlCollection = new static();

	if ($withHtml)
	{
		$previews = UrlPreview::getMetadataAndHtmlByIds($previewUrlsIds);
	}
	else
	{
		$previews = UrlPreview::getMetadataByIds($previewUrlsIds);
	}

	if ($previews === false)
	{
		return $urlCollection;
	}

	foreach ($previews as $preview)
	{
		$urlCollection[] = UrlItem::initByMetadata($preview);
	}

	return $urlCollection;
}