Exemplo n.º 1
0
 /**
  * Get the translated layout of mail.
  *
  * @param MailInterface $mail The mail
  *
  * @return LayoutInterface|null
  */
 protected function getTranslatedLayout(MailInterface $mail)
 {
     $layout = $mail->getLayout();
     if (null !== $layout) {
         $layout = TranslationUtil::translateLayout($layout, $this->getLocale(), $this->translator);
     }
     return $layout;
 }
 /**
  * Get the translated layout.
  *
  * @param string $layout The name of layout
  *
  * @return TwigLayout
  *
  * @throws UnknownLayoutException   When the layout template does not exist
  * @throws InvalidArgumentException When the layout is not a twig layout
  */
 public function getTranslatedLayout($layout)
 {
     $template = $this->layoutLoader->load($layout);
     $template = TranslationUtil::translateLayout($template, $this->getTemplater()->getLocale(), $this->translator);
     if (!$template instanceof TwigLayout) {
         $msg = 'The "%s" layout is not a twig layout';
         throw new InvalidArgumentException(sprintf($msg, $layout));
     }
     return $template;
 }