This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » eZ Publish 5 Platform » Override content-view-embed template
expandshrink

Override content-view-embed template

Override content-view-embed template

Friday 23 May 2014 1:45:56 pm - 7 replies

Hi,

In a ezxml attribute i have an object embed in relation to a file stored in my library. I want to change the display for exemple (Example: Download this document). How ?

There is a template ? I want to need a class also.

Thanks

Djoo

Friday 23 May 2014 1:55:18 pm

Hi

It uses the same process as for "full", "line" or custom view types. It just uses "embed" or "embed-inline" by default, depending on the type you choose in the admin. So you can easily apply the View provider documentation examples, using content_view instead of location_view, and embed instead of full.

Tuesday 27 May 2014 9:10:25 am

Hi Jérôme.

Thanks for your answer. Finaly i want to make a simple link to my object file. In eZ 4 i make this solution : http://bit.ly/1tgV2eb.
In your opinion is it possible with eZ 5? If so how? I struggle to see the logic in the new operation.

 

Thanks

Djoo

Tuesday 27 May 2014 9:45:28 am

Hi Johann

Yes, it should be easy to do so. 

  1. Create an content_view rule to match your embedded content, based on match rules (like for location_view, you can use the same matchers)
  2. You may want to specify a custom controller if you want to enrich your template and do the dirty job, as your template should be as light as possible blunk.gif Emoticon
  3. In your matched template, you can then generate your link. You may use ez_render_field(), specifying a custom template for some fields.

Wednesday 28 May 2014 11:13:01 am

Jérôme,

My link is in a ezxml attribute field arround by text.

I try your solution, i create this rule, but it does not work. Where is my mistake?

 content_view:            
             embed:                
                    link:                    
                       template: "DjooDesignBundle:content/link:embed.html.twig"                    
                       match:                        
                           Identifier\ContentType: [link]

Thanks

Wednesday 28 May 2014 11:32:10 am

Maybe you can post a gist with your code and the raw XMLText ? (tip: you can have several files in a gist).

Friday 30 May 2014 4:00:55 pm

This is my gist : https://gist.github.com/djoo/30fee36463753c25c822

I want to display "link" instead of classic link, but i think my rule is bad :/

After i need to recreate schema of link. There is a model controller ?

My goal its the same as http://bit.ly/1tgV2eb in eZ 4 .

Friday 30 May 2014 4:18:02 pm

Ah sorry, I misunderstood...

What you'll need here is to override the base XSL stylesheet used to render link tags. Note that link tags rendering is made by an XSL stylesheet and a PreConverter service (the PreConverter is always run before XSLT).

BTW: You can embed gists in forum replies blunk.gif Emoticon

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from