I'm separating this from the refactor theming patch into its own thread so we can hopefully reach agreement more quickly. You said the following in #19 in your comments:
+++ b/jw_player.module @@ -565,163 +658,218 @@ function jw_player_preset_load($machine_name = NULL) { + // Load the JW Player library and supporting Drupal functions. + $element['#attached']['library'][] = array('jw_player', 'jwplayer'); + $element['#attached']['library'][] = array('jw_player', 'jw_player_drupal');libraries can have dependencies I think in Drupal 7 too. So jw_player_drupal could depend on jw_player and you don't have to specify it twice.
Yes they can, but here is my question. All the other components in $libraries['jwplayer'] are external. We have the player code (cloud or self hosted), JW Player key, and integration files.
The code in jw_player.drupal.js is the connection between JW Player and Drupal. Does it make sense to include it in the same grouping, or should it be its own item? I'm fine either way, but we were trying to make a more clear separation between the two.
Also had considered including jw_player.drupal.js in the 'integration files' in jw_player_libraries_info, but my preference is to have the player JS loaded as late as possible, not in the header. Let me know if you agree.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | jw_player-add_player_js_file-2719977-6.patch | 1.7 KB | sgdev |
| #6 | interdiff-2719977-2-6.txt | 1.03 KB | sgdev |
| #2 | jw_player-add_player_js_file-2719977-2.patch | 1.56 KB | sgdev |
Comments
Comment #2
sgdev commentedHere is a patch that only does two things: adds
jw_player.drupal.jsto the existing jwplayer library, and includes the JavaScript file. It won't do anything for now, because it's not#attachedanywhere.If we can agree on the basic approach for this, it's one less item we have to discuss relative to refactor theming. Thanks.
Comment #3
berdirAll I meant here is to have the drupal library depend on the other one, so that is loaded automatically.
But anyway, IMHO we can't do this separately from the remaining feedback on that I added below because as I said, there, with what I suggested there, this dependency stuff is irrelevant anyway.
Comment #4
sgdev commentedMarking for review.
Comment #5
sgdev commentedYes, we're already aware of that, and needs to be addressed in the refactor theming patch. However I think this specific item can be handled on its own, separate from the rest of the theming issues.
All we're doing is adding a library and a JS file. They don't do anything at the moment, and won't until we have pre-render approach solidified anyway. Doesn't hurt anything.
Comment #6
sgdev commentedPer comment #31 in refactor theming, there is an update needed to this patch. Please see attached, thanks.
Comment #7
sgdev commentedWe have a new update for this patch. We found that JW Player causes major issues when live preview is enabled in Views. Any view containing a player cannot be edited or saved. This is due to the JavaScript not being attached to the live preview.
I would post a patch for review, but we're stuck as before... until some of the other 7.x-2.x patches are committed, there are going to be code conflicts.
Making a note to post the patch once other things are committed. Otherwise not much I can do.
Comment #8
aitala commentedAny news on the fixed patch?
Comment #9
sgdev commentedSee my comment here: https://www.drupal.org/node/2713725#comment-12179489