本文整理汇总了PHP中Magento\Framework\Mail\Template\TransportBuilder::setTemplateVars方法的典型用法代码示例。如果您正苦于以下问题:PHP TransportBuilder::setTemplateVars方法的具体用法?PHP TransportBuilder::setTemplateVars怎么用?PHP TransportBuilder::setTemplateVars使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Mail\Template\TransportBuilder
的用法示例。
在下文中一共展示了TransportBuilder::setTemplateVars方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configureEmailTemplate
/**
* Configure email template
*
* @return void
*/
protected function configureEmailTemplate()
{
$this->transportBuilder->setTemplateIdentifier($this->templateContainer->getTemplateId());
$this->transportBuilder->setTemplateOptions($this->templateContainer->getTemplateOptions());
$this->transportBuilder->setTemplateVars($this->templateContainer->getTemplateVars());
$this->transportBuilder->setFrom($this->identityContainer->getEmailIdentity());
}
示例2: execute
public function execute()
{
$email = $this->getRequest()->getParam('email');
$this->_transportBuilder->setTemplateIdentifier(self::EMAIL_TEMPLATE_TEST_ID);
$this->_transportBuilder->setFrom($this->_helper->getTestSender());
$this->_transportBuilder->addTo($email);
$this->_transportBuilder->setTemplateVars([]);
$this->_transportBuilder->setTemplateOptions(['area' => \Magento\Framework\App\Area::AREA_FRONTEND, 'store' => 1]);
$transport = $this->_transportBuilder->getTransport();
$transport->sendMessage();
/** @var \Magento\Framework\Controller\Result\Json $resultJson */
$resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
$resultJson->setData(['error' => 0]);
return $resultJson;
}