Advertisement
Guest User

Untitled

a guest
Aug 27th, 2016
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. class AmpController extends Controller
  2. {
  3.  
  4. /**
  5. * @Route("/ez-amp/{objectId}", name="ez_amp")
  6. */
  7.  
  8. public function viewObjectAction($objectId)
  9. {
  10.  
  11. $contentService = $this->get('ezpublish.api.service.content');
  12. $contentTypeService = $this->get('ezpublish.api.service.contenttype');
  13.  
  14. $contentObject = $contentService->loadContent($objectId);
  15. $contentType = $contentTypeService->loadContentType($contentObject->versionInfo->contentInfo->contentTypeId);
  16.  
  17. $params = array('content' => $contentObject);
  18.  
  19. return $this->render('amp/' . $contentType->identifier . '.html.twig', $params);
  20.  
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement