Skip to content
Advertisement

Shopware 6: How to Access Config Parameters in Twig Template of the Admin Module

I’m looking for a way to access configuration parameters in twig template of the admin module. I tried to access it by:

JavaScript

The problem is that in the twig template of the admin module {{ shopware.config }} isn’t available. I tried to access it by {{ dump(shopware.config) }} but it returns nothing. Am I doing something wrong?

Is there alternative to access plugin’s configuration parameters in the admin module?

Is there a way to pass php variables to twig template of the admin module?

Thanks in advance,

Cheers!

Advertisement

Answer

Try to use following service:

JavaScript

where domain is the Plugin name.

Of course, you should inject that service first

JavaScript

Using that service you can provide config value to twig template.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement