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.
Hi corbacho,
i have change a little bit your code.
This will implement the G+ API better, directly in the head of html.
All change can you see in the attachment.
Comment | File | Size | Author |
---|---|---|---|
google_plusone.patch | 1.63 KB | christian death |
Comments
Comment #1
corbacho CreditAttribution: corbacho commentedTrue, it looks cleaner using an array to build the script element, and then calling drupal_render on it. Instead of concatenating. But this is only for D7 and for the non-async script option. By now, I prefer to keep it as it is, so it's easier to maintain common code in D7 and D6 modules.
Other thing: It's not good idea to print script tags with drupal_add_html_head for performance reasons. This kind of non-important JavaScript should be printed in the bottom of the page, for the sake of those browsers where still the JavaScript loading blocks the rendering of the page.
I will have it in mind for the future
Thanks for the suggestion Christian