Reputation: 355
I'm looking for a way to access configuration parameters in twig template of the admin module. I tried to access it by:
{{ shopware.config.pluginName.config.fieldName }}
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!
Upvotes: 1
Views: 2396
Reputation: 87
I found the solution to help you access global configuration via
{{ dump(config('core.listing.fieldName')) }}
Upvotes: 1
Reputation: 905
Try to use following service:
this.systemConfigApiService.getValues('domain', this.selectedSalesChannelId)
where domain is the Plugin name.
Of course, you should inject that service first
inject: ['systemConfigApiService']
Using that service you can provide config value to twig template.
Upvotes: 3