Problem/Motivation

It appears that js libraries attached in hook_page_attachments(), in the ['#attached']['html_head'] get added to the unverified script list and therefor are not loaded onto the page.

Steps to reproduce

Proposed resolution

Remaining tasks

* reproduce
* fix

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

atowl created an issue. See original summary.

atowl’s picture

Uploading the patch that was supplied in the previous issue from @guillaumeg. It is the same file, just renamed to suit this issue so it can be discussed here.

atowl’s picture

atowl’s picture

For a reproduction so far i have tried
- install drupal/google_tag^1.8
- set up a new container (my_first_container), all fake-ish data and defaults.
- changed to opt-in with categories
- created 2 categories, one for my testing, and one for analytics (both unchecked by default).
- added my disabled javascripts

test_module:modules/custom/test_module/js/console_log.js|test_module
analytics:https://www.googletagmanager.com/gtag.js
analytics:sites/default/files/google_tag/my_first_container/google_tag.script.js

Now accepting the analytics category i don't see either of the two scripts pop up, however ever, applying @guillaumeg's patch, i see the both appear.

I think this is the reproduction that i'm looking for.

guillaumeg’s picture

Hi @atowl,

It sounds very much like the issue I had, and the patch seems to have fixed it now. :)

atowl’s picture

Status: Active » Needs review
StatusFileSize
new3.6 KB

Hi @guillaumeg,

I've attached a patch of the MR, if you could just confirm that works i'll look to merge it for the next release.

Thanks!

imran1217’s picture

Status: Needs review » Reviewed & tested by the community

I have validate the patch in #7 and its working fine.

  • atowl committed f70cbf02 on 8.x-1.x
    Issue #3534375 by atowl, guillaumeg, imran1217: Javascript libraries...
atowl’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for all the work, merging this, and it'll be in the next release shortly.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.