This site has been archived. To learn more about our current products Ibexa Content, Ibexa Experience, Ibexa Commerce head over to the Ibexa Developer Portal

eZ Community » Forums » eZ Publish 5 Platform » Sub menu

Sub menu

Sub menu

Friday 27 June 2014 1:13:32 pm - 10 replies


I use DemoBundle and function topMenuAction with MenuHelper.php in DemoController.php for show my menu. Now i want show submenu of this one. Is it provided in DemoBundle ? 

Thank you very much


Friday 27 June 2014 3:22:29 pm

I took a look at the code and it does not looks like it.

`MenuHelper->getTopMenuContent` restricts the locations it pulls to the parent so it does not return the children to generate submenus from. 

This would have to be changed along with the page_topmenu.html.twig template.

Perhaps by changing the criteria to use Subtree and Depth this could be done with little change needed.

Friday 27 June 2014 11:23:39 pm

You can take a look at this if you want.  It was a little more effort but it should give you a good start 

Wednesday 02 July 2014 4:43:19 pm

Oh thank you very much!

I'll try it and I inform you of my advanced happy.gif Emoticon


Wednesday 09 July 2014 9:05:06 am

Hi !

I tried to install it but i have this error :

An exception has been thrown during the rendering of a template ("Intentionally not implemented: No visitor available for: eZ\Publish\API\Repository\Values\Content\Query\Criterion\Subtree with operator ="blunk.gif Emoticon in ***Bundle::pagelayout.html.twig at line 16.

In MenuHelper.php, in getTopMenuContent() function, error seems to be in

 return $this->searchHelper->buildLocationTreeFromSearchResult( $subtree, 
 $this->repository->getSearchService()->findLocations( $query ) );

Thanks !

Modified on Wednesday 09 July 2014 9:55:18 am by Alizée Arnaud

Wednesday 09 July 2014 11:23:07 am

Hi Alizée,

from the exception it looks like you are using version 2014.03?
We made some changes for 5.3 release, so if that is the case you should update to 2014.05.


Wednesday 09 July 2014 11:41:13 am


2014.05 is in development on github no? Do you have a dead-line for the official version?
It's not yet downloadable on share.ez. I can not risk it if it's not stable ^^

Thank you

Wednesday 09 July 2014 1:20:24 pm

Hi Alizée,

v2014.05 has already been tagged and you can expect it on soonish.

Until then you can change the code to use Subtree and Visibility criterions from eZ\Publish\API\Repository\Values\Content\Query\Criterion\Location namespace, but have in mind they were removed, so you will need to change it back when upgrading to a newer version.


Wednesday 09 July 2014 1:37:43 pm

Ok i understand.

So can you tell me what code i have to change to use Subtree and Visibility ?


Thank you very much

Wednesday 09 July 2014 3:05:27 pm

These are the lines:

Changing them to Criterion\Location\Subtree and Criterion\Location\Visibility should do the trick.

Modified on Wednesday 09 July 2014 3:05:57 pm by Petar Španja

Thursday 10 July 2014 2:13:00 pm

So, it works better but i have an other problem...

In MenuHelper.php in getTopMenuContent function when i give a depth "3" it return top levels but i want an the sub levels. So i give depth "4" like it :

 $criteria = array(
    new Criterion\Location\Subtree( $subtree ),
    new Criterion\Location\Depth( Operator::LTE, 4 ),            
    new Criterion\Location\Visibility( Criterion\Visibility::VISIBLE )

Here you can see var_dump of 

 $this->repository->getSearchService()->findLocations( $query )

with depth "3" and "4". In the first one i have "Offre de prestation" (top level) and not "Conseil" (sub level of Offre de prestation) and with depth 4 i have "Conseil" (sub level of Offre de prestation) ans not "Offre de prestation" (top level)...

Help ! Thank you very much

Modified on Thursday 10 July 2014 2:13:39 pm by Alizée Arnaud


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from