Is it still possible to dynamically append script/files depending on the context?
I saw here it was possible in ZF1 but that doesn't work in ZF3.
Any Ideas?
Is it still possible to dynamically append script/files depending on the context?
I saw here it was possible in ZF1 but that doesn't work in ZF3.
Any Ideas?
Copyright © 2021 Jogjafile Inc.
You can do this but you need to inject the 'Head Script' view helper into the controller:
Then in the controller:
But the fact that this plugin is provided as a view helper suggests that they were expecting you to do this in the view, not in the controller. In that case it's much simpler:
If possible it would be cleaner to refactor your code so that you are injecting any variables you need to test as conditions for adding the js into the view model.