im trying to write an extension that works will depend on the environment. How to retrieve the name of the current environment inside the extension class? What is best practices?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
You'll have to inject the parameter in your extension constructor.
Either, you may refer to current envinroment in twig templates as app.environment
.