本文整理汇总了PHP中Magento\Framework\View\Asset\Repository::updateDesignParams方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::updateDesignParams方法的具体用法?PHP Repository::updateDesignParams怎么用?PHP Repository::updateDesignParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\View\Asset\Repository
的用法示例。
在下文中一共展示了Repository::updateDesignParams方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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];
}
$config = $this->viewConfigFactory->create();
$this->viewConfigs[$key] = $config;
return $config;
}
示例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: getStaticFileName
/**
* Find a static view file using fallback mechanism
*
* @param string $fileId
* @param array $params
* @return string
*/
public function getStaticFileName($fileId, array $params = [])
{
list($module, $filePath) = \Magento\Framework\View\Asset\Repository::extractModule($this->normalizePath($fileId));
if ($module) {
$params['module'] = $module;
}
$this->_assetRepo->updateDesignParams($params);
return $this->_staticFileResolution->getFile($params['area'], $params['themeModel'], $params['locale'], $filePath, $params['module']);
}
示例4: 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);
$viewConfigParams = [];
if (isset($params['themeModel'])) {
/** @var \Magento\Framework\View\Design\ThemeInterface $currentTheme */
$currentTheme = $params['themeModel'];
$key = $currentTheme->getCode();
if (isset($this->viewConfigs[$key])) {
return $this->viewConfigs[$key];
}
$viewConfigParams['themeModel'] = $currentTheme;
}
$viewConfigParams['area'] = isset($params['area']) ? $params['area'] : null;
/** @var \Magento\Framework\Config\View $config */
$config = $this->viewConfigFactory->create($viewConfigParams);
if (isset($key)) {
$this->viewConfigs[$key] = $config;
}
return $config;
}
示例5: getEmailTemplateFileName
/**
* Get an email template file
*
* @param string $fileId
* @param array $params
* @param string $module
* @return string|bool
*/
public function getEmailTemplateFileName($fileId, array $params, $module)
{
$this->_assetRepo->updateDesignParams($params);
return $this->_emailTemplateFileResolution->getFile($params['area'], $params['themeModel'], $params['locale'], $fileId, $module);
}
示例6: testUpdateDesignParamsWrongTheme
/**
* @expectedException \UnexpectedValueException
* @expectedExceptionMessage Could not find theme 'nonexistent_theme' for area 'area'
*/
public function testUpdateDesignParamsWrongTheme()
{
$params = ['area' => 'area', 'theme' => 'nonexistent_theme'];
$this->themeList->expects($this->once())->method('getThemeByFullPath')->with('area/nonexistent_theme')->will($this->returnValue(null));
$this->object->updateDesignParams($params);
}
示例7: testUpdateDesignParams
/**
* @param array $params
* @param array $result
* @return void
* @dataProvider updateDesignParamsDataProvider
*/
public function testUpdateDesignParams($params, $result)
{
$this->themeProvider->expects($this->any())->method('getThemeByFullPath')->willReturn('ThemeID');
$this->repository->updateDesignParams($params);
$this->assertEquals($result, $params);
}