當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。