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 » How to override content classes
expandshrink

How to override content classes

How to override content classes

Wednesday 10 April 2013 1:06:45 am - 7 replies

I have created a bundle with:

php ezpublish/console generate:bundle

In ./src/Cme/MiBundle/Resources/config/ezpublish.yml I have write:

imports:
    - { resource: override.yml } 
 

And in ./src/Cme/MiBundle/Resources/config/override.yml I have write this:

ezpublish:
    system:
        esl:
            location_view:
                full:
                    miclass:
                        template: MiBundle:full:miclass.html.twig
                        match:
                            Identifier\ContentType: miclass

And I have created a view in ./src/Cme/MiBundle/Resources/views/full/miclass.html.twig

But It doesn't work sad.gif Emoticon

What's wrong?

Modified on Wednesday 10 April 2013 1:19:50 am by Israel Martín

Wednesday 10 April 2013 8:50:30 am

Hello,

Do you have any error message ? Which version of eZ Publish do you use ? 

Try to replace 

template: MiBundle:full:miclass.html.twig
template: CmeMiBundle:full:miclass.html.twig

Cheers

Modified on Wednesday 10 April 2013 8:51:14 am by Philippe Vincent-Royol

Wednesday 10 April 2013 10:11:11 am

Philippe, thanks for answering.

I tried it too but it doesn't work neither (I did so because I see it in this post about planetezpublish.org).
https://github.com/dpobel/planet-...planet/ezpublish/config/override.yml

I think that the eZ doesn't read the ./src/Cme/MiBundle/Resources/config/override.yml file because eZ Publish doesn't throw errors nor warnings.

The version of eZ Publish is 1.2013

Modified on Wednesday 10 April 2013 10:17:14 am by Israel Martín

Wednesday 10 April 2013 8:24:15 pm

Yeah but becarful Damien used a "shortcut" for PlanetBundle (Its defined on https://github.com/dpobel/planet-ezpublish.fr/blob/master/planet/src/Planet/PlanetBundle/Resources/config/services.yml#L22) 

 

So if you don't do this you should use

 template: CmeMiBundle:full:miclass.html.twig

Could you check on SF toolbar, that you're correctly running ViewController::viewLocation and not using some fieldtype like ezpage ?

Cheers

Wednesday 10 April 2013 8:49:13 pm

I have test it and you are right, Philippe, the "Cme" is mandatory at the beginning.

Carlos Revillo helped me on GTalk and I have a "solution", in ./ezpublish/config/config.yml I added this:

- { resource: @CmeMiBundle/Resources/config/override.yml }

On the "imports" block.
Then, I can write my override rules on mi bundle ./src/Cme/MiBundle/Resources/config/override.yml

I tried to add this on ./src/Cme/MiBundle/Resources/config/config.yml and on ./src/Cme/MiBundle/Resources/config/ezpublish.yml (like on ezpublishplanet) and It doesn't work. 

Anybody know how to make that eZP read config files of the bundles?

Thanks for your help Philippe and C. Revillo and sorry for my english.

Modified on Wednesday 10 April 2013 8:51:11 pm by Israel Martín

Wednesday 10 April 2013 9:00:38 pm

Hi,

Symfony requires manual adding of config files via the DependencyInjection system. However, you will not be able to specify the "ezpublish" extension setting via a bundle. A system error will be thrown.

I have currently create a bundle that will allow you to prepend configuration settings based on http://symfony.com/doc/master/cookbook/bundles/prepend_extension.html.

Wednesday 10 April 2013 9:03:20 pm

Ahhh you was on your bundle .. sorry i didnt read correctly happy.gif Emoticon=

So if you would like to run configuration via a bundle you should used something like that on your services.yml or whatever other yml file (of course you need to add it on you bundle configuration to say to SF: hey boy you have to read my new yml file happy.gif Emoticon )

 

parameters
    ezsettings.esl.location_view:
        full:
            miclass:
                template:  CmeMiBundle:full:miclass.html.twig
                match:
                    Identifier\ContentType: miclass 

If you have time, you could add this tip to eZ 5 cheatsheet: https://github.com/dspe/eZ5_cheatsheet

Or i will do it later

Cheers

Modified on Wednesday 10 April 2013 9:05:11 pm by Philippe Vincent-Royol

Thursday 11 April 2013 11:02:15 am

I didn't knew the cheatsheet, It looks great.

I'm going to mark this post like "solved".

Thanks for yout help!.

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from