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 » Setup & design » Override a content template

Override a content template

Override a content template

Wednesday 20 March 2013 10:14:27 am - 6 replies

Hi everyone,

I've been trying to override the template displayed for a user in a page. The default template called when I use the ez_content:viewContent controller doesn't want to be replaced.

The parameters I use are in a override.yml located in my bundle in which the "location_view" ones work just fine, but the "content_view" one doesn't.

For information, it looks like this : 

                template: SqliMaquetteEz5Bundle:line:user.html.twig 
                match:  Identifier\ContentType: user

And I call the user by this render in my template : 

{{ render( controller( "ez_content:viewContent", {"contentId": content.contentInfo.ownerId, "viewType": "line"} ) ) }}

Is one of these wrong, or do I have to proceed another way ?
Thanks !

Modified on Wednesday 27 March 2013 6:45:53 pm by Nicolas Pastorino

Wednesday 27 March 2013 7:26:48 pm

Hi Pierre, and welcome to the eZ Community, 

Which version of eZ Publish are you using? I am asking because typically in 2013.1, the syntax for overrides configuration would look different:

                        template: eZBlahBundle:listedsubitems:folder.html.twig
                            Identifier\ContentType: folder

Let us know,

Thursday 28 March 2013 9:58:10 am

Hi ! Thanks for your answer !

I tried your syntax, replacing "location_view" by "content_view", but doesn't seem to take it into account, the default template is called like before. Il also tried the syntax on, but without success too.

All examples I found are overrides for the location_view, so I guess maybe the "content_view" one may be slightly different ?

Thanks again for your help.

Thursday 28 March 2013 10:39:59 am

I just left a comment on the related doc page, linking-back to our discussion right here, so we put our eZ Engineers in the loop. 

Cheers Pierre!

Thursday 28 March 2013 11:25:21 am

Hi Pierre !

This is actually a missing feature in 5.0. Until recently, it was not possible to have a template selection for ez_content:viewContent, it was only possible for ez_content:viewLocation (via the location_view configuration Nicolas is talking about).

If you browse eZ Publish kernel code to the View\Provider\Content\Configured, you'll see that it's empty sad.gif Emoticon. This has been implemented recently and it will be available as of 2013.3 / 5.1 EE.

However, you the provider still fallbacks to legacy, so you can still define old templates for your content.

Sorry for the inconvenience !

Thursday 28 March 2013 11:42:19 am

Hi Jérôme,

I'm relieved this isn't my fault ! And thank you for the quick answer happy.gif Emoticon

I'm not so familiar with the legacy (just jumped into ezpublish recently), so I think I'll use "location_view" by loading the content and retrieving its main location id then !

Anyway, thanks again to both of you for your great help !

Cheers guys !

Thursday 28 March 2013 11:50:14 am

Quote from Pierre Maraitre :

Hi Jérôme,

I'm relieved this isn't my fault ! And thank you for the quick answer happy.gif Emoticon

And thanks for pointing the issue Pierre.



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

36 542 Users on board!

Forums menu

Proudly Developed with from