Adds an asset to an asset collection

@param Asset $asset
@param AssetCollection $assetCollection
@return void
@throws IllegalObjectTypeException
174605
public function addAssetToCollectionAction(Asset $asset, AssetCollection $assetCollection): void
    {
        $success = false;
        if ($assetCollection->addAsset($asset)) {
            $this->assetCollectionRepository->update($assetCollection);
            $success = true;
        }
        $this->view->assign('value', $success);
    }
935717
def add_to_asset(connection, asset_id)
      params = to_json_for_add
      url    = "/api/2.0/assets/#{asset_id}/tags"
      uri    = AJAX.post(connection, url, params, AJAX::CONTENT_TYPE::JSON)
      @id    = uri.split('/').last.to_i
    end
143640
public function add($asset)
	{
		// More than one asset
		if(is_array($asset))
		{
			foreach($asset as $a)
				$this->add($a);
		}

		// Collection
		elseif(isset($this->collections[$asset]))
			$this->add($this->collections[$asset]);

		// JavaScript asset
		elseif(preg_match($this->js_regex, $asset))
			$this->addJs($asset);

		// CSS asset
		elseif(preg_match($this->css_regex, $asset))
			$this->addCss($asset);

		return $this;
	}
245366
@Override
    public T add(final Asset asset, final String target) throws IllegalArgumentException {
        // Precondition checks
        Validate.notNullOrEmpty(target, "target must be specified");
        Validate.notNull(asset, "asset must be specified");

        // Make a Path from the target
        final ArchivePath path = new BasicPath(target);

        // Delegate
        return this.add(asset, path);
    }
13784
public function addObject(AssetObjectInterface $aoi)
    {
        // Store f
        if ($aoi->getType() == 'file') {
            
            $dt = debug_backtrace();
            
            self::$files_used[self::$filecounter . '-' . $dt[1]['function']] = $aoi->getContent();
            self::$filecounter ++;
        }
        
        $this->objects[] = $aoi;
    }
1159129
public function findUntagged(AssetCollection $assetCollection = null)
    {
        $query = $this->createQuery();
        $query->matching($query->isEmpty('tags'));
        $this->addImageVariantFilterClause($query);
        $this->addAssetCollectionToQueryConstraints($query, $assetCollection);
        return $query->execute();
    }
499245
public function registerAssets()
    {
        foreach (array_merge($this->assets, $this->getTheme()->assets) as $asset) {
            /** @var AssetBundle $asset */
            $asset::register($this->getView());
        }
    }
1182543
protected function addingAssetUrl($assetUrl,$resources)
    {
        foreach ($resources as &$resource) {
            if (gettype($resource)=="string") {
                $resource = $assetUrl."/".$resource;
            } else if (gettype($resource)=="array") {
                $resource = $this->addingAssetUrl($assetUrl, $resource);
            }
        }
        return $resources;
    }
1077086
public function addPublicAsset($asset)
    {
        // Remove from protected / deleted lists
        $key = $this->getAssetKey($asset);
        unset($this->protected[$key]);
        unset($this->deleted[$key]);
        // Skip if already public
        if (isset($this->public[$key])) {
            return false;
        }
        unset($asset['Variant']);
        $this->public[$key] = $asset;
        return true;
    }
654472
public function insertAsset(AssetAbstract $asset, $location) {
		array_splice($this->assets, $location, 0, array($asset));
		return $this;
	}
1132605
public function registerAssetChange(AssetInterface $asset)
    {
        if (!$asset->isInUse()) {
            return;
        }

        $cachingHelper = $this->getCachingHelper();

        foreach ($this->assetService->getUsageReferences($asset) as $reference) {
            if (!$reference instanceof AssetUsageInNodeProperties) {
                continue;
            }

            $workspaceHash = $cachingHelper->renderWorkspaceTagForContextNode($reference->getWorkspaceName());

            $this->registerChangeOnNodeIdentifier($workspaceHash . '_' . $reference->getNodeIdentifier());
            $this->registerChangeOnNodeType($reference->getNodeTypeName(), $reference->getNodeIdentifier(), $workspaceHash);

            $assetIdentifier = $this->persistenceManager->getIdentifierByObject($asset);

            $tagName = 'AssetDynamicTag_' . $workspaceHash . '_' . $assetIdentifier;
            $this->tagsToFlush[$tagName] = sprintf('which were tagged with "%s" because asset "%s" has changed.', $tagName, $assetIdentifier);
        }
    }
1114434
public function markAssetAsIncluded($assetType, $assetHandle = false)
    {
        $list = AssetList::getInstance();
        if ($assetType && $assetHandle) {
            $asset = $list->getAsset($assetType, $assetHandle);
        } else {
            $assetGroup = $list->getAssetGroup($assetType);
        }

        if (isset($assetGroup)) {
            $this->providedAssetGroup->addGroup($assetGroup);
        } elseif (isset($asset)) {
            $ap = new AssetPointer($asset->getAssetType(), $asset->getAssetHandle());
            $this->providedAssetGroup->add($ap);
        } else {
            $ap = new AssetPointer($assetType, $assetHandle);
            $this->providedAssetGroupUnmatched[] = $ap;
        }
    }
536235
protected function mergeCollections(Asset $compiledAsset, Collection $passedCollection)
    {
        $compiledNames = [];

        $mergedCollection = (new Collection())->setGroup($compiledAsset->group());

        foreach ($compiledAsset->collection() as $asset) {
            $compiledNames[$asset->name()] = $asset;
        }

        $compiledAssetAdded = false;

        foreach ($passedCollection as $asset) {

            // asset is not in compiled asset
            if (!isset($compiledNames[$asset->name()])) {
                $mergedCollection->append($asset);
                continue;
            }

            if ($compiledAssetAdded) {
                continue;
            }

            $mergedCollection->append($compiledAsset);

            $compiledAssetAdded = true;
        }

        return $mergedCollection;
    }
290025
@Override
    public T add(final Asset asset, final String target, final String name) throws IllegalArgumentException {
        Validate.notNull(target, "target must be specified");
        final ArchivePath path = ArchivePaths.create(target);
        return this.add(asset, path, name);
    }
1165861
public RuntimeEnvironmentBuilder addAsset(Resource asset, ResourceType type) {
        if (asset == null || type == null) {
            return this;
        }
        _runtimeEnvironment.addAsset(asset, type);
        return this;
    }
111677
@Override
    public T add(Asset asset, String name) {
        this.getArchive().add(asset, name);
        return covarientReturn();
    }
1091263
protected function orderAsset(Asset $asset, array &$assets)
    {
        $order = $asset->getOrder() and $order--;

        // If an asset already exists at the given order key then we'll add one to the order
        // so the asset essentially appears after the existing asset. This makes sense since
        // the array of assets has been reversed, so if the last asset was told to be first
        // then when we finally get to the first added asset it's added second.
        if (array_key_exists($order, $assets))
        {
            array_splice($assets, $order, 0, array(null));
        }

        $assets[$order] = $asset;

        ksort($assets);
    }