本文整理汇总了PHP中Mautic\CoreBundle\Factory\MauticFactory::getInstalledThemes方法的典型用法代码示例。如果您正苦于以下问题:PHP MauticFactory::getInstalledThemes方法的具体用法?PHP MauticFactory::getInstalledThemes怎么用?PHP MauticFactory::getInstalledThemes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mautic\CoreBundle\Factory\MauticFactory
的用法示例。
在下文中一共展示了MauticFactory::getInstalledThemes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPath
/**
* {@inheritdoc}
*/
public function getPath()
{
$controller = str_replace('\\', '/', $this->get('controller'));
if (!empty($this->themeOverride)) {
try {
$theme = $this->factory->getTheme($this->themeOverride);
$themeDir = $theme->getThemePath();
} catch (\Exception $e) {
}
} else {
$theme = $this->factory->getTheme();
$themeDir = $theme->getThemePath();
}
$fileName = $this->get('name') . '.' . $this->get('format') . '.' . $this->get('engine');
$path = (empty($controller) ? '' : $controller . '/') . $fileName;
if (!empty($this->parameters['bundle'])) {
$bundleRoot = $this->factory->getSystemPath('bundles', true);
$addonRoot = $this->factory->getSystemPath('addons', true);
// Check for a system-wide override
$themePath = $this->factory->getSystemPath('themes', true);
$systemTemplate = $themePath . '/system/' . $this->parameters['bundle'] . '/' . $path;
if (file_exists($systemTemplate)) {
$template = $systemTemplate;
} else {
//check for an override and load it if there is
if (!empty($themeDir) && file_exists($themeDir . '/html/' . $this->parameters['bundle'] . '/' . $path)) {
// Theme override
$template = $themeDir . '/html/' . $this->parameters['bundle'] . '/' . $path;
} else {
preg_match('/Mautic(.*?)Bundle/', $this->parameters['bundle'], $match);
if (!empty($match[1]) && file_exists($bundleRoot . '/' . $match[1] . 'Bundle/Views/' . $path) || file_exists($addonRoot . '/' . $this->parameters['bundle'] . '/Views/' . $path)) {
// Mautic core template
$template = '@' . $this->get('bundle') . '/Views/' . $path;
}
}
}
} else {
$themes = $this->factory->getInstalledThemes();
if (isset($themes[$controller])) {
//this is a file in a specific Mautic theme folder
$theme = $this->factory->getTheme($controller);
$template = $theme->getThemePath() . '/html/' . $fileName;
}
}
if (empty($template)) {
//try the parent
return parent::getPath();
}
return $template;
}
示例2: __construct
/**
* @param MauticFactory $factory
*/
public function __construct(MauticFactory $factory)
{
$this->translator = $factory->getTranslator();
$this->themes = $factory->getInstalledThemes('asset');
$this->assetModel = $factory->getModel('asset');
}