Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This module defines jw_player_inline_js as TRUE in two instances but FALSE on the hook_init call. This causes the default to display as TRUE on the settings page but yet when it goes to runt he default falls back to FALSE, leading to potential confusion as to why the library isn't being included. This patch establishes a defined value to help mitigate this issue in the future.
Comment | File | Size | Author |
---|---|---|---|
jw_player-inlineconsistency.patch | 1.92 KB | btopro | |
Comments
Comment #1
weseze CreditAttribution: weseze commentedWhy not simple change the default behaviour to TRUE in the init hook?
Comment #2
btopro CreditAttribution: btopro commentedgenerally ambiguous bolean values used in multiple places should be defined as a global value to avoid inconsistencies like this from popping back up.
Comment #3
rickvug CreditAttribution: rickvug commentedI agree with btopro about changing this to a global.
The reason for not going with a simple hook_init implementation is to try to reduce page weight to improve front end performance. Many sites only use video on a handful of pages and don't want to load the player JS unless is is actually required. However caching can cause problems as the player JS is added via a process function. When the cached value is displayed this process function will not run, breaking the player. Inserting a JW Player video via an input filter is a good example of when a caching issue may crop up. For this reason there is a variable to switch to loading the player on all pages via hook_init. That is the thinking behind the present design. IMO whether or not this is the best possible design, or if it is worth the effort, can be tackled in another issue.
Comment #4
kingfisher64 CreditAttribution: kingfisher64 commentedPatch didn't apply cleanly against 26th Jan 2013 dev version.
Comment #5
btopro CreditAttribution: btopro commentedpretty easy patch, may want to do it by hand and reroll if you have an issue with it
Comment #6
ron_s CreditAttribution: ron_s commentedIn 7.x-2.x, we've removed all inline JS and are using
#attached
to ensure players render correctly even when caching is enabled.Please test the following patches along with 7.x-2.x-dev. Thanks.
* Refactor theming: https://www.drupal.org/node/2713725
* Add not empty checks and Repeat option: https://www.drupal.org/node/2719995
* Add js file to build player: https://www.drupal.org/node/2719977