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


PHP Repository::getStaticViewFileContext方法代码示例

本文整理汇总了PHP中Magento\Framework\View\Asset\Repository::getStaticViewFileContext方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::getStaticViewFileContext方法的具体用法?PHP Repository::getStaticViewFileContext怎么用?PHP Repository::getStaticViewFileContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\View\Asset\Repository的用法示例。


在下文中一共展示了Repository::getStaticViewFileContext方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateTranslationFileContent

 /**
  * @param string $content
  * @return void
  */
 public function updateTranslationFileContent($content)
 {
     $translationDir = $this->directoryList->getPath(DirectoryList::STATIC_VIEW) . \DIRECTORY_SEPARATOR . $this->assetRepo->getStaticViewFileContext()->getPath();
     if (!$this->driverFile->isExists($this->getTranslationFileFullPath())) {
         $this->driverFile->createDirectory($translationDir);
     }
     $this->driverFile->filePutContents($this->getTranslationFileFullPath(), $content);
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:12,代码来源:FileManager.php

示例2: updateTranslationFileContent

 /**
  * @param string $content
  * @return void
  */
 public function updateTranslationFileContent($content)
 {
     $translationDir = $this->directoryList->getPath(DirectoryList::STATIC_VIEW) . \DIRECTORY_SEPARATOR . $this->assetRepo->getStaticViewFileContext()->getPath();
     if (!$this->driverFile->isExists($this->getTranslationFileFullPath())) {
         $this->driverFile->createDirectory($translationDir, \Magento\Framework\Filesystem\Driver\File::WRITEABLE_DIRECTORY_MODE);
     }
     $this->driverFile->filePutContents($this->getTranslationFileFullPath(), $content);
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:12,代码来源:FileManager.php

示例3: getPlaceholderValue

 /**
  * Retrieves the value of a given placeholder
  *
  * @param string $placeholder
  * @return string
  */
 public function getPlaceholderValue($placeholder)
 {
     $context = $this->assetRepo->getStaticViewFileContext();
     switch ($placeholder) {
         case self::VAR_BASE_URL_PATH:
             return $context->getBaseUrl() . $context->getPath();
         default:
             return '';
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:16,代码来源:Variable.php

示例4: __construct

 /**
  * @param \Magento\Framework\RequireJs\Config\File\Collector\Aggregated $fileSource
  * @param \Magento\Framework\View\DesignInterface $design
  * @param \Magento\Framework\Filesystem $appFilesystem
  * @param \Magento\Framework\View\Asset\Repository $assetRepo
  */
 public function __construct(\Magento\Framework\RequireJs\Config\File\Collector\Aggregated $fileSource, \Magento\Framework\View\DesignInterface $design, \Magento\Framework\Filesystem $appFilesystem, \Magento\Framework\View\Asset\Repository $assetRepo)
 {
     $this->fileSource = $fileSource;
     $this->design = $design;
     $this->baseDir = $appFilesystem->getDirectoryRead(DirectoryList::ROOT);
     $this->staticContext = $assetRepo->getStaticViewFileContext();
 }
开发者ID:vasiljok,项目名称:magento2,代码行数:13,代码来源:Config.php

示例5: clearBundleJsPool

 /**
  * Remove all bundles from pool
  *
  * @return bool
  */
 public function clearBundleJsPool()
 {
     $dirWrite = $this->filesystem->getDirectoryWrite(DirectoryList::STATIC_VIEW);
     /** @var $context \Magento\Framework\View\Asset\File\FallbackContext */
     $context = $this->assetRepo->getStaticViewFileContext();
     $bundleDir = $context->getPath() . '/' . Config::BUNDLE_JS_DIR;
     return $dirWrite->delete($bundleDir);
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:FileManager.php

示例6: testGetStaticViewFileContext

 /**
  * @return void
  */
 public function testGetStaticViewFileContext()
 {
     $themeMock = $this->getMock('Magento\\Framework\\View\\Design\\ThemeInterface', [], [], '', false);
     $this->designMock->expects($this->any())->method('getDesignParams')->willReturn(['themeModel' => $themeMock, 'area' => 'area', 'locale' => 'locale']);
     $this->themeProvider->expects($this->any())->method('getThemeByFullPath')->willReturnArgument(0);
     $this->httpMock->expects($this->any())->method('isSecure')->willReturn(false);
     $fallbackContextMock = $this->getMockBuilder('Magento\\Framework\\View\\Asset\\File\\FallbackContex')->disableOriginalConstructor()->getMock();
     $this->fallbackFactoryMock->expects($this->once())->method('create')->with(['baseUrl' => '', 'areaType' => 'area', 'themePath' => '', 'localeCode' => 'locale', 'isSecure' => ''])->willReturn($fallbackContextMock);
     $this->assertEquals($fallbackContextMock, $this->repository->getStaticViewFileContext());
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:13,代码来源:RepositoryTest.php

示例7: testGetStaticViewFileContext

 public function testGetStaticViewFileContext()
 {
     $this->mockDesign();
     $context = $this->object->getStaticViewFileContext();
     $this->assertInstanceOf('\\Magento\\Framework\\View\\Asset\\ContextInterface', $context);
     $this->assertSame($context, $this->object->getStaticViewFileContext());
     // to ensure in-memory caching
     $asset = $this->object->createAsset('test/file.js');
     $this->assertSame($context, $asset->getContext());
     // and once again to ensure in-memory caching for real
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:11,代码来源:RepositoryTest.php

示例8: createBundleJsPool

 /**
  * Create a view assets representing the bundle js functionality
  *
  * @return \Magento\Framework\View\Asset\File[]
  */
 public function createBundleJsPool()
 {
     $bundles = [];
     if ($this->appState->getMode() == AppState::MODE_PRODUCTION) {
         $libDir = $this->filesystem->getDirectoryRead(DirectoryList::STATIC_VIEW);
         /** @var $context \Magento\Framework\View\Asset\File\FallbackContext */
         $context = $this->assetRepo->getStaticViewFileContext();
         $bundleDir = $context->getPath() . '/' . Config::BUNDLE_JS_DIR;
         if (!$libDir->isExist($bundleDir)) {
             return [];
         }
         foreach ($libDir->read($bundleDir) as $bundleFile) {
             $relPath = $libDir->getRelativePath($bundleFile);
             $bundles[] = $this->assetRepo->createArbitrary($relPath, '');
         }
     }
     return $bundles;
 }
开发者ID:Coplex,项目名称:magento2,代码行数:23,代码来源:FileManager.php

示例9: getConfig

 /**
  * Return Wysiwyg config as \Magento\Framework\DataObject
  *
  * Config options description:
  *
  * enabled:                 Enabled Visual Editor or not
  * hidden:                  Show Visual Editor on page load or not
  * use_container:           Wrap Editor contents into div or not
  * no_display:              Hide Editor container or not (related to use_container)
  * translator:              Helper to translate phrases in lib
  * files_browser_*:         Files Browser (media, images) settings
  * encode_directives:       Encode template directives with JS or not
  *
  * @param array|\Magento\Framework\DataObject $data Object constructor params to override default config values
  * @return \Magento\Framework\DataObject
  */
 public function getConfig($data = [])
 {
     $config = new \Magento\Framework\DataObject();
     $config->setData(['enabled' => $this->isEnabled(), 'hidden' => $this->isHidden(), 'use_container' => false, 'add_variables' => true, 'add_widgets' => true, 'no_display' => false, 'encode_directives' => true, 'baseStaticUrl' => $this->_assetRepo->getStaticViewFileContext()->getBaseUrl(), 'baseStaticDefaultUrl' => str_replace('index.php/', '', $this->_backendUrl->getBaseUrl()) . $this->filesystem->getUri(DirectoryList::STATIC_VIEW) . '/', 'directives_url' => $this->_backendUrl->getUrl('cms/wysiwyg/directive'), 'popup_css' => $this->_assetRepo->getUrl('mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/dialog.css'), 'content_css' => $this->_assetRepo->getUrl('mage/adminhtml/wysiwyg/tiny_mce/themes/advanced/skins/default/content.css'), 'width' => '100%', 'height' => '500px', 'plugins' => []]);
     $config->setData('directives_url_quoted', preg_quote($config->getData('directives_url')));
     if ($this->_authorization->isAllowed('Magento_Cms::media_gallery')) {
         $config->addData(['add_images' => true, 'files_browser_window_url' => $this->_backendUrl->getUrl('cms/wysiwyg_images/index'), 'files_browser_window_width' => $this->_windowSize['width'], 'files_browser_window_height' => $this->_windowSize['height']]);
     }
     if (is_array($data)) {
         $config->addData($data);
     }
     if ($config->getData('add_variables')) {
         $settings = $this->_variableConfig->getWysiwygPluginSettings($config);
         $config->addData($settings);
     }
     if ($config->getData('add_widgets')) {
         $settings = $this->_widgetConfig->getPluginSettings($config);
         $config->addData($settings);
     }
     return $config;
 }
开发者ID:BlackIkeEagle,项目名称:magento2-continuousphp,代码行数:37,代码来源:Config.php

示例10: createTranslateConfigAsset

 /**
  * Create a view asset representing the requirejs config.config property for inline translation
  *
  * @return \Magento\Framework\View\Asset\File
  */
 public function createTranslateConfigAsset()
 {
     return $this->assetRepo->createArbitrary($this->assetRepo->getStaticViewFileContext()->getPath() . '/' . self::TRANSLATION_CONFIG_FILE_NAME, '');
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:9,代码来源:FileManager.php

示例11: getTranslationFilePath

 /**
  * @return string
  */
 public function getTranslationFilePath()
 {
     return $this->assetRepo->getStaticViewFileContext()->getPath();
 }
开发者ID:IlyaGluschenko,项目名称:protection,代码行数:7,代码来源:FileManager.php

示例12: __construct

 /**
  * @param \Magento\Framework\RequireJs\Config\File\Collector\Aggregated $fileSource
  * @param \Magento\Framework\View\DesignInterface $design
  * @param ReadFactory $readFactory
  * @param \Magento\Framework\View\Asset\Repository $assetRepo
  * @param \Magento\Framework\Code\Minifier\AdapterInterface $minifyAdapter
  * @param Minification $minification
  */
 public function __construct(\Magento\Framework\RequireJs\Config\File\Collector\Aggregated $fileSource, \Magento\Framework\View\DesignInterface $design, ReadFactory $readFactory, \Magento\Framework\View\Asset\Repository $assetRepo, \Magento\Framework\Code\Minifier\AdapterInterface $minifyAdapter, Minification $minification)
 {
     $this->fileSource = $fileSource;
     $this->design = $design;
     $this->readFactory = $readFactory;
     $this->staticContext = $assetRepo->getStaticViewFileContext();
     $this->minifyAdapter = $minifyAdapter;
     $this->minification = $minification;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:17,代码来源:Config.php


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