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.
Problem/Motivation
Module hardcodes filename for delivered JS but for http://dgo.to/domain it needs separate files.
I guess the same required to handle core's multisiting
Proposed resolution
Add custom hook to alter generated filename or store filename on config to allow config overrides to take over fine name
Remaining tasks
Discuss solution, create patch & commit
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#13 | interdiff-11-13.txt | 1.27 KB | piggito |
#13 | 2860275-domain-13.patch | 4.16 KB | piggito |
Comments
Comment #2
ilya.no CreditAttribution: ilya.no as a volunteer and at Skilld for Skilld commentedThere is a patch for basic support without using hook. Just checking, whether domain module is enabled and getting active domain id for adding it to the filename.
Comment #3
andypostGreat workaround but it needs a bit more work to be accepted
Comment #4
SpadXIII CreditAttribution: SpadXIII at ezCompany commentedRe-rolled the patch against latest dev.
I agree it's a workaround and it should be something more permanent. Instead of having a dependency on domain, an alter to change the filenames would be better.
Though I'm not sure why each domain should have a unique js file.
Comment #5
SpadXIII CreditAttribution: SpadXIII at ezCompany commentedAnd of course I forgot to attach a new patch...
Comment #6
dennisvdberg91 CreditAttribution: dennisvdberg91 at Dutch Open Projects commented@spadXlll @andypost
I would appreciate if this does not create like files for every domain, since there are websites with many domains.
Im not sure if this is what your patch does? what are your thoughts?
Comment #7
solotandem CreditAttribution: solotandem commentedThe patch is unacceptable [no patch should be necessary].
What needs to be done first is for Drupal 8 core to fully implement the 7.x variable project (including variable_realm module) and implement realms properly with an UI, etc. instead of the half-baked partial implementation that exists. [The last I checked this had not been done. If someone knows otherwise please comment.]
Next we restore the 7.x realm functionality of this module. Last, you add a domain realm and configure your sites, all without any special code changes for the domain integration.
Comment #8
andypostThis issue for 8.x
Comment #9
solotandem CreditAttribution: solotandem commented@andypost Please read what I wrote. It only refers to 8x.
Comment #10
andypostAh, you mean to adopt realm... but core 8 already implements overrides for config & that's what domain module using now
So looking at patch all we need is configurable file patch,
means that file name should use "path-template" that should be stored in config for domain overrides
Comment #11
andypostI think there could be compromise with this patch as approach
- Adds separate setting
snippets_path_prefix
that required to have variations of path per domain or whatever- Settings form will affect only one domain and needs test
- No update hook yet
Comment #12
ayalon CreditAttribution: ayalon at Liip commented@andypost:
The latest path is not working. I had to change it:
If you use $this->config('google_tag.settings') it is not domain sensitive. I was not able to figure out why.
Comment #13
piggito CreditAttribution: piggito as a volunteer and at Skilld commentedNormally, after saving settings form the snippet file should be created with the defined prefix. However, this wasn't working cause there isn't a form element for the
snippets_path_prefix
setting.I'm adding a form element and including this new setting for config save on submitForm.
Comment #14
ptmkenny CreditAttribution: ptmkenny commentedComment #15
solotandem CreditAttribution: solotandem commented@andypost et al Do the five recent commits to enable multiple containers provide a solution for the domain context? Can you create a container for each domain and use the config override capability from core to set the correct one? And disable the others? Or remove the other domain items from the attachments added to the page render array?
See #3035196-9: Add support for multiple containers.
Comment #16
santhosh.fernando CreditAttribution: santhosh.fernando as a volunteer commentedDo we have instructions on how this patch should works with domains? Do we have a path forward on how this should work?
Comment #17
solotandem CreditAttribution: solotandem commented@santosh Are you referring to patch in #13? If so, did you read my comment in #15? It suggests that a patch is not necessary but that the latest development release should support domain.
Comment #18
solotandem CreditAttribution: solotandem commentedThe dev release includes the ability to create multiple containers. Among the commits pushed today is a domain condition plugin that allows you to select the domains to which a container applies.
Comment #19
andypostLooks very promissing https://git.drupalcode.org/project/google_tag/commit/1dd4323882a44cbc0ab...