문제

Drupal 7 adds a new 'weight' option to drupal_add_js so that you can control the order in which Javascript files are added to the page. Is there any way to do this when adding Javascript in .info files?

도움이 되었습니까?

해결책

But to answer the actual question, the order that the files are included in the .info file should be the order that they appear on the page.

다른 팁

Despite its instructions to not use it for adding JS to every page, hook_init() will allow you to add JS in an more sophisticated way with drupal_add_js().

That said, it is rare that a JS file must be loaded on EVERY page, so there is likely more optimization you can do. Also see the FAPI property #attached for adding JS to a form.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 drupal.stackexchange
scroll top