Skip to content

Instantly share code, notes, and snippets.

@wizhippo
Last active August 24, 2017 19:27
Show Gist options
  • Save wizhippo/14c3d7c6b044c78135c4d1589edb2a35 to your computer and use it in GitHub Desktop.
Save wizhippo/14c3d7c6b044c78135c4d1589edb2a35 to your computer and use it in GitHub Desktop.
{{ ez_render_field( global_layout_object, 'page' ) }}
<? php
/**
* Displays the extra info section that contains the global layout
*
* @return Response
*/
public function viewExtraInfoAction()
{
$query = new Query(
[
'query' => new Criterion\LogicalAnd(
[
new Criterion\ContentTypeIdentifier(['global_layout']),
new Criterion\Subtree($this->getRootLocation()->pathString),
new Criterion\Visibility(Criterion\Visibility::VISIBLE),
new Criterion\LanguageCode(
$this->getConfigResolver()->getParameter('languages')
)
]
),
'limit' => 1,
'performCount' => false
]
);
$searchHits = $this->getRepository()->getSearchService()->findContent($query)->searchHits;
$globalLayoutObject = $searchHits[0]->valueObject;
return $this->render(
'@AppBundle/parts/extra_info.html.twig',
['global_layout_object' => $globalLayoutObject]
)
->setSharedMaxAge(600)
->setVary('X-User-Hash');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment