本文整理匯總了PHP中Swift_Message::setDescription方法的典型用法代碼示例。如果您正苦於以下問題:PHP Swift_Message::setDescription方法的具體用法?PHP Swift_Message::setDescription怎麽用?PHP Swift_Message::setDescription使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Swift_Message
的用法示例。
在下文中一共展示了Swift_Message::setDescription方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setDescription
/**
* {@inheritdoc}
*
* @return $this|self
*/
public function setDescription($description) : self
{
$this->message->setDescription($description);
return $this;
}
示例2: render
/**
* Render a message for the given recipient.
*
* @param RecipientInterface $recipient
* @param array $additionalData
*
* @return \Avisota\Message\MessageInterface
* @internal param array $newsletterData Additional newsletter data.
*
* @internal param RecipientInterface $recipientEmail The main recipient.
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function render(RecipientInterface $recipient = null, array $additionalData = array())
{
/** @var EventDispatcher $eventDispatcher */
$eventDispatcher = $GLOBALS['container']['event-dispatcher'];
// dispatch a pre render event
$event = new PreRenderMessageTemplateEvent($this->message, $this, $recipient, $additionalData);
$eventDispatcher->dispatch($event::NAME, $event);
// fetch updates on additional data
$additionalData = $event->getAdditionalData();
$content = $this->parseContent($recipient, $additionalData);
$swiftMessage = new \Swift_Message();
$name = trim($recipient->get('forename') . ' ' . $recipient->get('surname'));
$swiftMessage->setTo($recipient->getEmail(), $name);
$swiftMessage->setSubject($this->message->getSubject());
$swiftMessage->setBody($content, $this->getContentType(), $this->getContentEncoding());
$swiftMessage->setDescription($this->message->getDescription());
if ($this->message->getAddFile()) {
$files = deserialize($this->message->getFiles(), true);
foreach ($files as $file) {
$file = \Compat::resolveFile($file);
if ($file) {
$attachment = \Swift_Attachment::fromPath(TL_ROOT . '/' . $file);
$swiftMessage->attach($attachment);
}
}
}
$message = new ContaoAwareNativeMessage($swiftMessage, $this->message, array($recipient));
// dispatch a post render event
$event = new PostRenderMessageTemplateEvent($this->message, $this, $recipient, $additionalData, $message);
$eventDispatcher->dispatch($event::NAME, $event);
return $message;
}