本文整理汇总了PHP中Magento\Framework\View\Page\Config::getAssetCollection方法的典型用法代码示例。如果您正苦于以下问题:PHP Config::getAssetCollection方法的具体用法?PHP Config::getAssetCollection怎么用?PHP Config::getAssetCollection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\View\Page\Config
的用法示例。
在下文中一共展示了Config::getAssetCollection方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _prepareLayout
/**
* Include RequireJs configuration as an asset on the page
*
* @return $this
*/
protected function _prepareLayout()
{
$requireJsConfig = $this->fileManager->createRequireJsConfigAsset();
$requireJsMixinsConfig = $this->fileManager->createRequireJsMixinsAsset();
$assetCollection = $this->pageConfig->getAssetCollection();
$after = RequireJsConfig::REQUIRE_JS_FILE_NAME;
if ($this->minification->isEnabled('js')) {
$minResolver = $this->fileManager->createMinResolverAsset();
$assetCollection->insert($minResolver->getFilePath(), $minResolver, $after);
$after = $minResolver->getFilePath();
}
if ($this->bundleConfig->isBundlingJsFiles()) {
$bundleAssets = $this->fileManager->createBundleJsPool();
$staticAsset = $this->fileManager->createStaticJsAsset();
/** @var \Magento\Framework\View\Asset\File $bundleAsset */
if (!empty($bundleAssets) && $staticAsset !== false) {
$bundleAssets = array_reverse($bundleAssets);
foreach ($bundleAssets as $bundleAsset) {
$assetCollection->insert($bundleAsset->getFilePath(), $bundleAsset, $after);
}
$assetCollection->insert($staticAsset->getFilePath(), $staticAsset, reset($bundleAssets)->getFilePath());
$after = $staticAsset->getFilePath();
}
}
$assetCollection->insert($requireJsConfig->getFilePath(), $requireJsConfig, $after);
$assetCollection->insert($requireJsMixinsConfig->getFilePath(), $requireJsMixinsConfig, $after);
return parent::_prepareLayout();
}
示例2: addInlineTranslationConfig
/**
* Include RequireJs inline translation configuration as an asset on the page
* @return void
*/
private function addInlineTranslationConfig()
{
if ($this->inline->isAllowed()) {
$after = RequireJsConfig::REQUIRE_JS_FILE_NAME;
$tConfig = $this->fileManager->createTranslateConfigAsset();
$assetCollection = $this->pageConfig->getAssetCollection();
$assetCollection->insert($tConfig->getFilePath(), $tConfig, $after);
}
}
示例3: _prepareLayout
/**
* Include RequireJs configuration as an asset on the page
*
* @return $this
*/
protected function _prepareLayout()
{
$requireJsConfig = $this->fileManager->createRequireJsConfigAsset();
$assetCollection = $this->pageConfig->getAssetCollection();
$assetCollection->insert($requireJsConfig->getFilePath(), $requireJsConfig, RequireJsConfig::REQUIRE_JS_FILE_NAME);
if ($this->bundleConfig->isBundlingJsFiles()) {
$bundleAssets = $this->fileManager->createBundleJsPool();
$staticAsset = $this->fileManager->createStaticJsAsset();
/** @var \Magento\Framework\View\Asset\File $bundleAsset */
if (!empty($bundleAssets) && $staticAsset !== false) {
$bundleAssets = array_reverse($bundleAssets);
foreach ($bundleAssets as $bundleAsset) {
$assetCollection->insert($bundleAsset->getFilePath(), $bundleAsset, RequireJsConfig::REQUIRE_JS_FILE_NAME);
}
$assetCollection->insert($staticAsset->getFilePath(), $staticAsset, RequireJsConfig::CONFIG_FILE_NAME);
}
}
return parent::_prepareLayout();
}
示例4: renderAssets
/**
* Returns rendered HTML for all Assets (CSS before)
*
* @param array $resultGroups
*
* @return string
*/
public function renderAssets($resultGroups = [])
{
/** @var $group \Magento\Framework\View\Asset\PropertyGroup */
foreach ($this->pageConfig->getAssetCollection()->getGroups() as $group) {
$type = $group->getProperty(GroupedCollection::PROPERTY_CONTENT_TYPE);
if (!isset($resultGroups[$type])) {
$resultGroups[$type] = '';
}
$resultGroups[$type] .= $this->renderAssetGroup($group);
}
return implode('', $resultGroups);
}
示例5: getAssetCollection
/**
* {@inheritdoc}
*/
public function getAssetCollection()
{
$pluginInfo = $this->pluginList->getNext($this->subjectType, 'getAssetCollection');
if (!$pluginInfo) {
return parent::getAssetCollection();
} else {
return $this->___callPlugins('getAssetCollection', func_get_args(), $pluginInfo);
}
}