I have created a Subscriber.php file that assigns values from config.xml file to the css variables using the following tutorial:
I want to pass these variables to inline css in my index.html.twig file. Can someone help me out as to how I can get this done?
Passing variables from PHP to Twig templates is not that hard. I have a tutorial about this on my Shopware blog: How to get the data from PHP to the Twig template - Shopwarian.com. It also includes an example with a subscriber, so I think that is what you are looking for.
2 „Gefällt mir“
That is not working for me.
This is the code that I have in my Subscriber file. I want the variables $configPlugintextcolor and $configPluginfontsize to be accessible in my twig file.
When I do a dump in my index.html.twig file, I get this on the storefront:
I tried searching via ctrl+f in the dump but the variables are still not there
This is my index.html.twig file for reference: