• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/v2/Image/ImageCollection.php
  • Класс: BitrixCatalogv2ImageImageCollection
  • Вызов: ImageCollection::create
public function create(string $type = null): BaseImage
{
	if ($type === ImageFactory::DETAIL_IMAGE || $type === ImageFactory::PREVIEW_IMAGE)
	{
		$entity = $this->findByType($type);
		if ($entity)
		{
			throw new NotSupportedException(sprintf(
				'Collection {%s} already contains {%s} entity.', static::class, $type
			));
		}
	}

	$image = $this->factory->createEntity($type);

	$this->add($image);

	return $image;
}