/** * Returns the available js assets defined in the module manifest dependent * on a given type ("module" or "script") and the current mode of execution * @private * @param \Render\APIs\APIv1\HeadAPI $api * @param string $assetType * @param \Render\ModuleInfo $moduleInfo * @return array */ private function getJsAssets($api, $assetType, $moduleInfo) { $customData = $moduleInfo->getCustomData(); $jsAssets = $this->getValue('assets.js', $customData, array()); $result = array(); foreach ($jsAssets as $asset) { $mode = $this->getValue('mode', $asset, ''); $type = $this->getValue('type', $asset, 'script'); if ($type === $assetType && $this->isAvailableInMode($mode, $api)) { if (!$this->cachebusterDisabled) { $cachebuster = new CacheBuster(); $cachebuster->setModuleManifest($moduleInfo->getManifest()); $result[] = $moduleInfo->getAssetUrl($cachebuster->suffix($this->getValue('file', $asset))); } else { $result[] = $moduleInfo->getAssetUrl($this->getValue('file', $asset)); } } } return $result; }