When multiple players are displayed (e.g. an unlimited cardinality field) each player has a duplicate ID.
Patch to follow.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | youtube-multiple-ids-2268873-6.patch | 5.44 KB | Anonymous (not verified) |
| #1 | youtube-multiple-ids-2268873-1.patch | 2.87 KB | msmithcti |
Comments
Comment #1
msmithcti commentedAttached is a patch that moves the configurable ID to a class and uses drupal_html_id() to ensure IDs are unique. This will break and JS/CSS targeting a second or greater video embed as drupal_html_id() will append an integer onto the ID name. The first video on the page should not be affected by this change.
Comment #2
guschilds commentedsplatio,
Thanks for this. It definitely makes sense. A couple thoughts:
Why not just delete this variable when creating the youtube_playerclass variable in
youtube_update_7101and then remove it completely fromyoutube_uninstall()?This is what is shown when updating the db with drush or otherwise so it typically makes more sense to write what is actually happening. See views.install for an example.
Probably want to update the title of this option. Also wondering if we remove the visibility state so it is always visible. Maybe even add a description explaining that the player's ID will be based on this value, which brings me to my final thought:
Why not just base the ID off
$player_classwithdrupal_html_id($player_class)? That may reduce confusion.Let me know your thoughts. I can re-roll the patch with these changes if you'd like. Definitely makes sense to commit this in some form, though!
Thanks again,
Gus
Comment #3
guschilds commentedComment #5
guschilds commentedA variation of the patch in #2 was committed to the 7.x-1.x branch and will be available in the next release.
I'm marking this as "[8.x]" in the title and version to ensure that this gets fixed for the 8.x branch as well.
Comment #6
Anonymous (not verified) commentedThis patch fixes the problem in 8.x. Please apply the patch from #22 of #2213867: [8.x blocker] 8.x branch is out of date with current Drupal 8 release before this one.
Comment #8
guschilds commentedI had to reroll the patch in #6 because it no longer applied (I also think there was also some stuff left in there from another issue). Once I did, I successfully tested and committed your work. You did miss setting the variable when the config form is saved, so I added that in another commit.
Thanks again for your work here and patience as I slowly get to testing everything!
Comment #9
guschilds commented