in eZ Publish

eZ Publish Platform – Switch from legacy

Bundles

First of all, the new eZ Publish does not have extension. This is replaced with “Bundles” as in Symfony 2 bundles. Good practice is to check out the DemoBundle that ships with eZ Publish.  You could forexample base your code on the DemoBundle if you want, that is possible because Symfony 2 bundles can “extend” another bundle. So you can override some files or just add new functionality.

You can read more about bundles in the Symfony 2 official documentation.

Getting the current language

Sometimes you would want to get the current language from a Controller, or maybe a custom service you are creating.

To find the main language code, e.g. “eng-GB”, get hold of the repository’s getCurrentUser() method like so:

Template overrides

Template overrides are now defined in YAML configuration files. You can create bundles that have default rules for overrides and a site bundle that can override these default rules. Creating rules is simple:

 

Share this post

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Write a Comment

Comment