本文整理汇总了PHP中Mautic\CoreBundle\Factory\MauticFactory::getTheme方法的典型用法代码示例。如果您正苦于以下问题:PHP MauticFactory::getTheme方法的具体用法?PHP MauticFactory::getTheme怎么用?PHP MauticFactory::getTheme使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mautic\CoreBundle\Factory\MauticFactory
的用法示例。
在下文中一共展示了MauticFactory::getTheme方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
$pluginRoot = $this->factory->getSystemPath('plugins', true);
// @deprecated 1.1.4; to be removed in 2.0; BC support for MauticAddon
$addonRoot = $this->factory->getSystemPath('root') . '/addons';
// 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($pluginRoot . '/' . $this->parameters['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: setEmail
/**
* @param Email $email
* @param bool $allowBcc Honor BCC if set in email
* @param array $slots Slots configured in theme
* @param array $assetAttachments Assets to send
* @param bool $ignoreTrackingPixel Do not append tracking pixel HTML
*/
public function setEmail(Email $email, $allowBcc = true, $slots = array(), $assetAttachments = array(), $ignoreTrackingPixel = false)
{
$this->email = $email;
// Set message settings from the email
$this->setSubject($email->getSubject());
$fromEmail = $email->getFromAddress();
$fromName = $email->getFromName();
if (!empty($fromEmail) && !empty($fromEmail)) {
$this->setFrom($fromEmail, $fromName);
} else {
if (!empty($fromEmail)) {
$this->setFrom($fromEmail, $this->from);
} else {
if (!empty($fromName)) {
$this->setFrom(key($this->from), $fromName);
}
}
}
$replyTo = $email->getReplyToAddress();
if (!empty($replyTo)) {
$this->setReplyTo($replyTo);
}
if ($allowBcc) {
$bccAddress = $email->getBccAddress();
if (!empty($bccAddress)) {
$this->addBcc($bccAddress);
}
}
if ($plainText = $email->getPlainText()) {
$this->setPlainText($plainText);
}
$template = $email->getTemplate();
if (!empty($template)) {
if (empty($slots)) {
$template = $email->getTemplate();
$slots = $this->factory->getTheme($template)->getSlots('email');
}
if (isset($slots[$template])) {
$slots = $slots[$template];
}
$customHtml = $this->setTemplate('MauticEmailBundle::public.html.php', array('slots' => $slots, 'content' => $email->getContent(), 'email' => $email, 'template' => $template), true);
} else {
// Tak on the tracking pixel token
$customHtml = $email->getCustomHtml();
}
if (empty($assetAttachments)) {
if ($assets = $email->getAssetAttachments()) {
foreach ($assets as $asset) {
$this->attachAsset($asset);
}
}
} else {
foreach ($assetAttachments as $asset) {
$this->attachAsset($asset);
}
}
$this->setBody($customHtml, 'text/html', null, $ignoreTrackingPixel);
}
示例3: setEmail
/**
* @param Email $email
* @param bool $allowBcc Honor BCC if set in email
* @param array $slots Slots configured in theme
* @param array $assetAttachments Assets to send
* @param bool $ignoreTrackingPixel Do not append tracking pixel HTML
*/
public function setEmail(Email $email, $allowBcc = true, $slots = [], $assetAttachments = [], $ignoreTrackingPixel = false)
{
$this->email = $email;
$subject = $email->getSubject();
// Convert short codes to emoji
$subject = EmojiHelper::toEmoji($subject, 'short');
// Set message settings from the email
$this->setSubject($subject);
$fromEmail = $email->getFromAddress();
$fromName = $email->getFromName();
if (!empty($fromEmail) && !empty($fromEmail)) {
$this->setFrom($fromEmail, $fromName);
} elseif (!empty($fromEmail)) {
$this->setFrom($fromEmail, $this->from);
} elseif (!empty($fromName)) {
$this->setFrom(key($this->from), $fromName);
}
$replyTo = $email->getReplyToAddress();
if (!empty($replyTo)) {
$this->setReplyTo($replyTo);
}
if ($allowBcc) {
$bccAddress = $email->getBccAddress();
if (!empty($bccAddress)) {
$this->addBcc($bccAddress);
}
}
if ($plainText = $email->getPlainText()) {
$this->setPlainText($plainText);
}
$BCcontent = $email->getContent();
$customHtml = $email->getCustomHtml();
// Process emails created by Mautic v1
if (empty($customHtml) && !empty($BCcontent)) {
$template = $email->getTemplate();
if (empty($slots)) {
$template = $email->getTemplate();
$slots = $this->factory->getTheme($template)->getSlots('email');
}
if (isset($slots[$template])) {
$slots = $slots[$template];
}
$this->processSlots($slots, $email);
$logicalName = $this->factory->getHelper('theme')->checkForTwigTemplate(':' . $template . ':email.html.php');
$customHtml = $this->setTemplate($logicalName, ['slots' => $slots, 'content' => $email->getContent(), 'email' => $email, 'template' => $template], true);
}
// Convert short codes to emoji
$customHtml = EmojiHelper::toEmoji($customHtml, 'short');
$this->setBody($customHtml, 'text/html', null, $ignoreTrackingPixel);
// Reset attachments
$this->assets = $this->attachedAssets = [];
if (empty($assetAttachments)) {
if ($assets = $email->getAssetAttachments()) {
foreach ($assets as $asset) {
$this->attachAsset($asset);
}
}
} else {
foreach ($assetAttachments as $asset) {
$this->attachAsset($asset);
}
}
}