<?php
/**
*
* Copyright (c) 2017. The Cocktail
*
* This file is part of the Movistar Originales package.
*
*/
namespace AppBundle\Controller;
use eZ\Bundle\EzPublishCoreBundle\Controller;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
class ThemeController extends Controller
{
public function notAccesibleAction(Request $request)
{
throw new NotFoundHttpException('Not accesible content');
}
public function faviconAction($contentId)
{
$contentService = $this->get('ezpublish.api.service.content');
$rootContent = $contentService->loadContent($contentId);
return $this->render(':content:_favicon.html.twig', ['content' => $rootContent ]);
}
public function redirectAction(Request $request, $path, $site)
{
$siteAccess = $request->attributes->get('siteaccess');
if ($siteAccess->name !== $site) {
throw new NotFoundHttpException('Page not found');
}
return $this->redirect($path, 301);
}
}