当前位置: 首页>>代码示例>>PHP>>正文


PHP Config::getAssetCollection方法代码示例

本文整理汇总了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();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:33,代码来源:Config.php

示例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);
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:13,代码来源:Config.php

示例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();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:24,代码来源:Config.php

示例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);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:19,代码来源:Renderer.php

示例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);
     }
 }
开发者ID:CSYE6225,项目名称:UnixSysProgramming,代码行数:12,代码来源:Interceptor.php


注:本文中的Magento\Framework\View\Page\Config::getAssetCollection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。