本文整理匯總了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;
}
示例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;
}
示例3: testGetFilename
/**
* @dataProvider getFilenameDataProvider
* @magentoAppIsolation enabled
*/
public function testGetFilename($file, $params)
{
$this->_emulateFixtureTheme();
$this->assertFileExists($this->_viewFileSystem->getFilename($file, $params));
}