當前位置: 首頁>>代碼示例>>PHP>>正文


PHP FileSystem::getFilename方法代碼示例

本文整理匯總了PHP中Magento\Framework\View\FileSystem::getFilename方法的典型用法代碼示例。如果您正苦於以下問題:PHP FileSystem::getFilename方法的具體用法?PHP FileSystem::getFilename怎麽用?PHP FileSystem::getFilename使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Framework\View\FileSystem的用法示例。


在下文中一共展示了FileSystem::getFilename方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getWidgetConfigAsArray

 /**
  * Load widget XML config and merge with theme widget config
  *
  * @return array|null
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  */
 public function getWidgetConfigAsArray()
 {
     if ($this->_widgetConfigXml === null) {
         $this->_widgetConfigXml = $this->_widgetModel->getWidgetByClassType($this->getType());
         if ($this->_widgetConfigXml) {
             $configFile = $this->_viewFileSystem->getFilename('widget.xml', ['area' => $this->getArea(), 'theme' => $this->getThemeId(), 'module' => $this->_namespaceResolver->determineOmittedNamespace(preg_replace('/^(.+?)\\/.+$/', '\\1', $this->getType()), true)]);
             $isReadable = $configFile && $this->_directory->isReadable($this->_directory->getRelativePath($configFile));
             if ($isReadable) {
                 $config = $this->_reader->readFile($configFile);
                 $widgetName = isset($this->_widgetConfigXml['name']) ? $this->_widgetConfigXml['name'] : null;
                 $themeWidgetConfig = null;
                 if ($widgetName !== null) {
                     foreach ($config as $widget) {
                         if (isset($widget['name']) && $widgetName === $widget['name']) {
                             $themeWidgetConfig = $widget;
                             break;
                         }
                     }
                 }
                 if ($themeWidgetConfig) {
                     $this->_widgetConfigXml = array_replace_recursive($this->_widgetConfigXml, $themeWidgetConfig);
                 }
             }
         }
     }
     return $this->_widgetConfigXml;
 }
開發者ID:whoople,項目名稱:magento2-testing,代碼行數:33,代碼來源:Instance.php

示例2: getViewConfig

    /**
     * Render view config object for current package and theme
     *
     * @param array $params
     * @return \Magento\Framework\Config\View
     */
    public function getViewConfig(array $params = [])
    {
        $this->assetRepo->updateDesignParams($params);
        /** @var $currentTheme \Magento\Framework\View\Design\ThemeInterface */
        $currentTheme = $params['themeModel'];
        $key = $currentTheme->getCode();
        if (isset($this->viewConfigs[$key])) {
            return $this->viewConfigs[$key];
        }

        $configFiles = $this->moduleReader->getConfigurationFiles(basename($this->filename))->toArray();
        $themeConfigFile = $currentTheme->getCustomization()->getCustomViewConfigPath();
        if (empty($themeConfigFile)
            || !$this->rootDirectory->isExist($this->rootDirectory->getRelativePath($themeConfigFile))
        ) {
            $themeConfigFile = $this->viewFileSystem->getFilename($this->filename, $params);
        }
        if ($themeConfigFile
            && $this->rootDirectory->isExist($this->rootDirectory->getRelativePath($themeConfigFile))
        ) {
            $configFiles[$this->rootDirectory->getRelativePath($themeConfigFile)] = $this->rootDirectory->readFile(
                $this->rootDirectory->getRelativePath($themeConfigFile)
            );
        }
        $config = $this->viewFactory->create($configFiles);

        $this->viewConfigs[$key] = $config;
        return $config;
    }
開發者ID:nblair,項目名稱:magescotch,代碼行數:35,代碼來源:Config.php

示例3: testGetFilename

 /**
  * @dataProvider getFilenameDataProvider
  * @magentoAppIsolation enabled
  */
 public function testGetFilename($file, $params)
 {
     $this->_emulateFixtureTheme();
     $this->assertFileExists($this->_viewFileSystem->getFilename($file, $params));
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:9,代碼來源:DesignTest.php


注:本文中的Magento\Framework\View\FileSystem::getFilename方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。