AcMailer\Service\MailService::setDefaultLayout PHP Method

setDefaultLayout() public method

Sets the default layout to be used with all the templates set when calling setTemplate.
public setDefaultLayout ( AcMailer\View\DefaultLayoutInterface $layout = null ) : mixed
$layout AcMailer\View\DefaultLayoutInterface
return mixed
    public function setDefaultLayout(DefaultLayoutInterface $layout = null)
    {
        $this->defaultLayout = isset($layout) ? $layout : new DefaultLayout();
    }

Usage Example

 public function testWithDefaultLayout()
 {
     $resolver = new TemplatePathStack();
     $resolver->addPath(__DIR__ . '/../../view');
     $this->mailService->getRenderer()->setResolver($resolver);
     $model = new ViewModel();
     $model->setTemplate('ac-mailer/mail-templates/layout.phtml');
     $this->mailService->setDefaultLayout(new DefaultLayout($model));
     $this->mailService->setTemplate('ac-mailer/mail-templates/mail.phtml');
     $this->assertInstanceOf('Zend\\Mime\\Message', $this->mailService->getMessage()->getBody());
 }
All Usage Examples Of AcMailer\Service\MailService::setDefaultLayout