php - EzPublish render searchHits in Twig -


i have following code retrieve main menu on ezpublish 5.4 site:

$query = new locationquery();     $query->query = new criterion\logicaland(         array(             new criterion\contenttypeidentifier( $this->gettopmenucontenttypeidentifierlist() ),             new criterion\visibility( criterion\visibility::visible ),             new criterion\location\depth(                 criterion\operator::between,                 array( $rootlocation->depth + 1, $rootlocation->depth + 3 )             ),             new criterion\subtree( $rootlocation->pathstring ),             new criterion\languagecode( $configresolver->getparameter( 'languages' ) )         )     );     $query->sortclauses = array( new query\sortclause\location\depth(), new query\sortclause\location\priority() );     $main_menu = $searchservice->findlocations( $query )->searchhits; 

this works, results expect , give array twig template:

{% item in menu %} <a href="#menuitemurl">menu item title in current language</a> {% endfor %} 

two questions: 1: how url searchhit rendered in twig ? have no clue this, google didn't 2: how title of searchhit in current site's language? site multilingual, every item available in both swedish english, somehow english title above code, when on swedish version

you load corresponding content objects :

$contentlist = []; foreach ( $searchservice->findlocations( $query )->searchhits $hit ) {     $contentlist[] = $this->contentservice->loadcontent( $hit->valueobject->contentinfo->id ); }; 

and pass $contentlist[] template. use content full url.

or render contents in templates based on content id searchhits.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

how to prompt save As Box in Excel Interlop c# MVC 4 -

xslt 1.0 - How to access or retrieve mets content of an item from another item? -