Example #1
0
 /**
  * Renders a page given its path
  *
  * @param string $path Page path
  *
  * @return Response Generated response
  *
  * @throws NotFoundHttpException Page not found
  */
 public function renderByPathAction($path = '')
 {
     /**
      * @var PageInterface $page
      */
     $page = $this->pageRepository->findOneByPath($path);
     return $this->pageResponseTransformer->createResponseFromPage($page, $path);
 }
 /**
  * Send email
  *
  * @param string $emailName     Email name
  * @param array  $context       Context
  * @param string $receiverEmail Receiver email
  */
 protected function sendEmail($emailName, array $context, $receiverEmail)
 {
     $page = $this->pageRepository->findOneBy(['name' => $emailName]);
     if ($page instanceof PageInterface) {
         $template = $this->templateLocator->locate(':email.html.twig');
         $resolvedPage = $this->twig->render($template, array_merge(['title' => $page->getTitle(), 'content' => $page->getContent()], $context));
         $message = $this->mailer->createMessage()->setSubject($page->getTitle())->setFrom($this->store->getEmail())->setTo($receiverEmail)->setBody($resolvedPage, 'text/html');
         $this->mailer->send($message);
     }
 }
Example #3
0
 /**
  * Get blog pages
  *
  * @param integer $page          Page
  * @param integer $numberPerPage Number per page
  *
  * @return array Collection of enabled pages for the blog
  */
 public function getBlogPages($page = 1, $numberPerPage = 10)
 {
     return $this->pageRepository->findPages(ElcodiPageTypes::TYPE_BLOG_POST, $page, $numberPerPage);
 }