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
You should be able to include custom script type attributes, e.g. "application/json" or "text/x-handlebars-template".
Proposed resolution
Only unset the script type attribute if it is "text/javascript".
Comment | File | Size | Author |
---|---|---|---|
#3 | only_remove_redundant-2608420-3.patch | 1.05 KB | jtwalters |
#2 | only_remove_redundant-2608420-2.patch | 1022 bytes | jtwalters |
Comments
Comment #2
jtwalters CreditAttribution: jtwalters commentedHere's a patch.
Comment #3
jtwalters CreditAttribution: jtwalters commentedAdding an isset check for avoiding PHP notices.
Comment #4
steinmb CreditAttribution: steinmb as a volunteer commentedThis is allow us to use the #attribute instead of resorting to drupa_add_js()? Sorry, I'm not a js developer.
Comment #5
jtwalters CreditAttribution: jtwalters commentedThis patch simply allows you to use a custom type attribute on a script tag/element. It doesn't matter how you add the script tag. Omega is being too opinionated about removing the type attribute.
Comment #6
BarisW CreditAttribution: BarisW at LimoenGroen commentedLooks good!
This also enabled Omega themes to use the application/ld+json type.
Comment #7
tbenice CreditAttribution: tbenice commentedJust endorsing getting this in a release. I have to do some hackity stuff to make this work for google social profiles (ld+json).
Thanks!
Comment #8
DamienMcKennaFYI this is a useful fix for sites using Schema.org Metatag (schema_metatag).