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 » ezp5 current siteaccess name
expandshrink

ezp5 current siteaccess name

ezp5 current siteaccess name

Monday 16 March 2015 11:16:04 am - 2 replies

Hi i am working on an ezpublish bundle (CjwThemeBundle) which allows to use themes (design) in the way we could use it in ezpublish 4 (fallbackdesign). 

- overriding of twig templates

- overriding of assets

Now i need access to the value of the curentSiteaccessName in my ThemeService.

Can anybody give me an example what is the best way to get the current SiteaccesName in ezpublish 5 context?

I need it as key for cache generation.

Thank's

Modified on Monday 16 March 2015 11:27:59 am by Felix Woldt

Monday 16 March 2015 12:30:04 pm

i found the solution happy.gif Emoticon

To inject the current siteaccess to a service you can do the following in the service.yml configuration => useing:

@ezpublish.siteaccess

 

     cjw_theme.active_theme_service:
        class: '%cjw_theme.active_theme_service.class%'
        calls:
        - [setSiteAccess, [@ezpublish.siteaccess]]

Modified on Monday 16 March 2015 12:32:34 pm by Felix Woldt

Monday 16 March 2015 1:46:59 pm

Hi Felix

Yep, you found the right solution happy.gif Emoticon. In templates, you can get the siteaccess via ezpublish helper: 

{% set siteaccess = ezpublish.siteaccess %}

I'm quite curious of your theme solution, feel free to share happy.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