I am writing a component+helper pair which handle inclusion of JS files for the current View.
The idea is to autoload JS files which have the same name as the view (or action). So if you have a view called 'admin_add.ctp' and a file 'admin_add.js' in the same folder, the JS file would be included in the JS buffer. I would prefer this to happen automatically in both beforeRender calls.
The tricky part is that I need to be able to enable/disable the autoload at the Controller::action level (with a component), but the inclusion logic needs to happen at the View level (with a Helper).
How do I pass the enable/disable trigger from the Component to the Helper, without having to write code in each view template?