Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I have a module that provides an input filter for Drupal 6 and 7. It renders some elements using a (heavy) JavaScript module that I don't want to include on every page.

In Drupal 6 the input filter would run and if a element that needed rendering was present the JavaScript files were added using the drupal_add_js(...) method in the process step of the input filter. This works fine.

In Drupal 7 however, drupal_add_js(...) is only executed when I clear the cache. Otherwise the page is rendered but the JavaScript files aren't added. At first I thought that this was due to caching of the input filter. However I have set cache=>FALSE for hook_filter_info() and indeed $cache is FALSE in the process step.

Any suggestions how to fix this?

share|improve this question
    
Where is your drupal_add_js() call located? If its inside of hook_filter_info() it will not work as expected. A better option is to use form alter and attach the JS. –  mikeytown2 Jun 24 '14 at 18:11
    
It's inside the process callback that is provided by hook_filter_info. –  Tim Jun 25 '14 at 11:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.