Adds to the assets collection the extra parameters defined by extraAssetsSuffixes

@param AssetCollection $assetsCollection
@param string            $baseParam
437449
protected function addExtraAssets(&$assetsCollection, $baseParam)
    {
        if (! $this->extraAssets) {
            return;
        }

        $parameter = sprintf('%s.cms', $baseParam);
        $this->addAssetsFromContainer($assetsCollection, $parameter);
    }
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;
        }
    }
371590
protected function addAssetsFromOtherStages(AssetManipulationList $manipulation)
    {
        // Skip unversioned or unsaved assets
        if (!$this->isVersioned() || !$this->owner->isInDB()) {
            return;
        }

        // Unauthenticated member to use for checking visibility
        $baseClass = $this->owner->baseClass();
        $baseTable = $this->owner->baseTable();
        $filter = array(
            Convert::symbol2sql("{$baseTable}.ID") => $this->owner->ID,
        );
        $stages = $this->owner->getVersionedStages(); // {@see Versioned::getVersionedStages}
        foreach ($stages as $stage) {
            // Skip current stage; These should be handled explicitly
            if ($stage === Versioned::get_stage()) {
                continue;
            }

            // Check if record exists in this stage
            $record = Versioned::get_one_by_stage($baseClass, $stage, $filter);
            if (!$record) {
                continue;
            }

            // Check visibility of this record, and record all attached assets
            $state = $this->getRecordState($record);
            $this->addAssetsFromRecord($manipulation, $record, $state);
        }
    }
654472
public function insertAsset(AssetAbstract $asset, $location) {
		array_splice($this->assets, $location, 0, array($asset));
		return $this;
	}
1329065
@Override
    public T addAsApplicationResource(Asset resource, ArchivePath target) throws IllegalArgumentException {
        Validate.notNull(resource, "Resource must be specified");
        Validate.notNull(target, "Target must be specified");

        ArchivePath location = new BasicPath(getApplicationPath(), target);
        return add(resource, location);
    }
691071
public function addLtiLinkItemExtended($params = array())
    {
        global $CFG;

        // populate the default parameters
        if (empty($params['title']))
            $params['title'] = false;
        if (empty($params['text']))
            $params['text'] = false;
        if (empty($params['icon']))
            $params['icon'] = false;
        if (empty($params['fa_icon']))
            $params['fa_icon'] = false;
        if (empty($params['custom']))
            $params['custom'] = false;
        if (empty($params['points']))
            $params['points'] = false;
        if (empty($params['activityId']))
            $params['activityId'] = false;
        if (empty($params['placementTarget']))
            $params['placementTarget'] = 'iframe';
        if (empty($params['placementWindowTarget']))
            $params['placementWindowTarget'] = '';
        if (empty($params['placementWidth']))
            $params['placementWidth'] = '';
        if (empty($params['placementHeight']))
            $params['placementHeight'] = '';

        $item = '{ "@type" : "LtiLinkItem",
                    "@id" : ":item2",
                    "title" : "A cool tool hosted in the Tsugi environment.",
                    "mediaType" : "application/vnd.ims.lti.v1.ltilink",
                    "text" : "For more information on how to build and host powerful LTI-based Tools quickly, see www.tsugi.org",
                    "url" : "http://www.tsugi.org/",
                    "placementAdvice" : {
                        "presentationDocumentTarget" : "iframe"
                    },
                    "icon" : {
                        "@id" : "https://static.tsugi.org/img/default-icon.png",
                        "fa_icon" : "fa-magic",
                        "width" : 64,
                        "height" : 64
                    },
                    "lineItem" : {
                        "@type" : "LineItem",
                        "label" : "Gradable External Tool",
                        "reportingMethod" : "res:totalScore",
                        "assignedActivity" : {
                            "@id" : "http://toolprovider.example.com/assessment/66400",
                            "activityId" : "a-9334df-33"
                        },
                        "scoreConstraints" : {
                            "@type" : "NumericLimits",
                            "normalMaximum" : 10
                        }
                    }
                }';

        $item = '{
            "type": "ltiResourceLink",
            "title": "A title",
            "url": "https://lti.example.com/launchMe",
            "presentation": {
                "documentTarget": "iframe",
                "width": 500,
                "height": 600
            },
            "icon": {
                "url": "https://lti.example.com/image.jpg",
                "fa_icon" : "fa-magic",
                "width": 100,
                "height": 100
            },
            "thumbnail": {
                "url": "https://lti.example.com/thumb.jpg",
                "width": 90,
                "height": 90
            },
            "lineItem": {
                "scoreMaximum": 87,
                "label": "Chapter 12 quiz",
                "resourceId": "xyzpdq1234",
                "tag": "originality"
            },
            "custom": {
                "quiz_id": "az-123",
                "duedate": "$Resource.submission.endDateTime"
            },
            "window": {
                "targetName": "examplePublisherContent"
            },
            "iframe": {
                "height": 890
            }
       }';

        $json = json_decode($item);
        $json->url = $params['url'];
        if ( $params['title'] ) $json->{'title'} = $params['title'];
        // TODO: WTF? Text is gone?
        // if ( $params['text'] ) $json->text = $params['text'];
        if ( $params['icon'] ) $json->icon->url = $params['icon'];
        if ( $params['fa_icon'] ) $json->icon->fa_icon = $params['fa_icon'];
        unset($json->custom);
        if ( $params['custom'] ) $json->custom = $params['custom'];
        if ( $params['points'] && $params['activityId'] ) {
            $json->lineItem->label = $params['title'];
            // Leave guid in as an extension until we are forced to get rid of it :)
            $json->lineItem->guid = $CFG->wwwroot . '/lti/activity/' . $params['activityId'];
            $json->lineItem->resourceId = $params['activityId'];
            $json->lineItem->scoreMaximum = $params['points'];
        } else {
            unset($json->lineItem);
        }

        if ($params['placementTarget'])
            $json->presentation->documentTarget = $params['placementTarget'];
        if ($params['placementWindowTarget'])
            $json->presentation->windowTarget = $params['placementWindowTarget'];
        if (! empty($params['placementWidth']))
            $json->presentation->width = $params['placementWidth'];
        if (! empty($params['placementHeight']))
            $json->presentation->height = $params['placementHeight'];

        $this->items[] = $json;
    }
938947
public function append($value): BaseCollection
    {
        $this->validate($value);

        parent::append($value);

        return $this;
    }
1340404
@Override
    public AssetPage addAsset(AssetPage asset, boolean renderImmediately) {
        final String assetKey = asset.getReference().toString();
        if(assets.containsKey(assetKey)) {
            return assets.get(assetKey);
        }
        else {
            assets.put(assetKey, asset);
            if(renderImmediately) {
                context.get().renderAsset(asset);
            }

            return asset;
        }
    }
646538
public function getAssetRenderer($baseUrl = null, $basePath = null)
    {
        if ($this->jsRenderer === null) {
            $this->jsRenderer = new AssetsRenderer($this, $baseUrl, $basePath);
        }

        return $this->jsRenderer;
    }
63289
protected function mergeAppBlocksAssets(AssetCollection $assetsCollection, array $options)
    {
        // When a block has examined, it is saved in this array to avoid parsing it again
        $appsAssets = array();

        // merges assets from installed apps

        foreach ($this->availableBlocks as $className) {
            if ( ! in_array($className, $appsAssets)) {
                $parameterSchema = '%s.%s_%s';
                $parameter = sprintf($parameterSchema, strtolower($className), $options["type"], $options["assetType"]);
                $this->addAssetsFromContainer($assetsCollection, $parameter);
                $this->addExtraAssets($assetsCollection, $parameter);

                $appsAssets[] = $className;
            }
        }

        return $assetsCollection;
    }
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);
    }
776740
protected function checkType($value)
    {
        if (!$value instanceof AssetContract) {
            throw new InvalidArgumentException("You can only add values of '{$this->forceType}' to this list");
        }

        if (!$mimeType = $value->mimeType()) {
            throw new InvalidArgumentException('The added asset must have a mimeType to add it to this collection');
        }

        if (!$this->mimeType) {
            $this->mimeType = $mimeType;

            return;
        }

        if ($this->mimeType != $mimeType) {
            throw new InvalidArgumentException("This collection accepts only mimeType {$this->mimeType} not $mimeType");
        }
    }
535694
public function showAction(string $assetSourceIdentifier, string $assetProxyIdentifier): void
    {
        if (!isset($this->assetSources[$assetSourceIdentifier])) {
            throw new \RuntimeException('Given asset source is not configured.', 1509702178);
        }

        $assetProxyRepository = $this->assetSources[$assetSourceIdentifier]->getAssetProxyRepository();
        try {
            $assetProxy = $assetProxyRepository->getAssetProxy($assetProxyIdentifier);

            $this->view->assignMultiple([
                'assetProxy' => $assetProxy,
                'assetCollections' => $this->assetCollectionRepository->findAll()
            ]);
        } catch (AssetNotFoundExceptionInterface $e) {
            $this->throwStatus(404, 'Asset not found');
        } catch (AssetSourceConnectionExceptionInterface $e) {
            $this->view->assign('connectionError', $e);
        }
    }
1259894
function forEachAsset(assets, callback, finishedCallback) {
	async.forEachSeries(Object.keys(assets), function(extensionName, nextGroup) {
		var extensionAssets = assets[extensionName];
		async.forEachSeries(Object.keys(extensionAssets), function(groupName, nextAssetType) {
			var group = extensionAssets[groupName];
			async.forEachSeries(group, function(asset, nextAsset) {
				callback({
					extensionAssets : extensionAssets,
					extensionName : extensionName,
					group : group,
					groupName : groupName,
					asset : asset
				}, nextAsset);
			}, function(err) { nextAssetType(err); });
		}, function(err) { nextGroup(err); });
	}, function(err) { finishedCallback(err); });
}
1099849
function addFromArray($assets) {
        if (!is_array($assets)) $assets = [$assets];
        foreach ($assets as $key => $asset) {
            if ($key === 'debug') {
                if (self::$debug) $this->addFromArray($asset);
            } else if ($key === 'prod') {
                if (!self::$debug) $this->addFromArray($asset);
            } else {
                if (isset(self::$libs[$asset])) {
                    $this->addLib($asset);
                } elseif (substr($asset, -4) == '.css' || strpos($asset,'.css?v=') !== false) {
                    $this->addCss($asset);
                } else {
                    $this->addJs($asset);
                }
            }
        }
    }
1097175
public function add($name, $source = null, $dependencies = array(), $attributes = array())
    {
        if(!is_array($name)) {
            if(!isset($source)) throw new \ErrorException("Missing argument 2 for Facuz\Theme\AssetContainer::add()", 1);
            
            return $this->added($name, $source, $dependencies, $attributes);
        }

        foreach ($name as $array) {
            if(count($array) < 2) throw new \ErrorException("Missing value 2 of the array for Facuz\Theme\AssetContainer::add()", 1);
            $container = $array[0];
            $source = $array[1]; 
            $dependencies = isset($array[2]) ? $array[2] : [];
            $attributes = isset($array[3]) ? $array[3] : [];

            $this->add($container, $source, $dependencies, $attributes);
        }

        $this->usePath(false);
    }
198544
public function registerAssetsCollection()
    {
        $this->app->singleton('assets.collection', function ($app) {
            return new AssetsCollection;
        });

        $this->app->alias('assets.collection', AssetsCollection::class);
    }