Skip to content

Instantly share code, notes, and snippets.

@janit
Created August 27, 2016 08:37
Show Gist options
  • Select an option

  • Save janit/2abba723c03134254c4b6b7d7437acb2 to your computer and use it in GitHub Desktop.

Select an option

Save janit/2abba723c03134254c4b6b7d7437acb2 to your computer and use it in GitHub Desktop.
class AmpController extends Controller
{
/**
* @Route("/ez-amp/{objectId}", name="ez_amp")
*/
public function viewObjectAction($objectId)
{
$contentService = $this->get('ezpublish.api.service.content');
$contentTypeService = $this->get('ezpublish.api.service.contenttype');
$contentObject = $contentService->loadContent($objectId);
$contentType = $contentTypeService->loadContentType($contentObject->versionInfo->contentInfo->contentTypeId);
$params = array('content' => $contentObject);
return $this->render('amp/' . $contentType->identifier . '.html.twig', $params);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment