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.
One problem with the current codebase is that the AddThis config code is inserted in the footer for every widget displayed on the page. If you happen to load the widget on every node teaser, you end up having a lot of duplicate JS code.
Comment | File | Size | Author |
---|---|---|---|
#12 | 2333231-use-attached-12.patch | 66.54 KB | matglas86 |
#3 | addthis-n2333231-2.patch | 1.15 KB | DamienMcKenna |
Comments
Comment #1
DamienMcKennaIn local testing this worked reasonably well.
Comment #2
DamienMcKennaResolves a problem if $configurationOptionsJavascript is not an array.
Comment #3
DamienMcKennaComment #4
matglas86 CreditAttribution: matglas86 commentedI rewrote the whole management of adding script to the page. This should solve a lot of problems. Maybe you could review this and see if it works correctly.
Its in my guthub account in the branch features/script-manager
https://github.com/matglas/addthis/tree/features/script-manager
Comment #5
matglas86 CreditAttribution: matglas86 commentedHere is the patch comming from the github branch mentioned in #4.
Comment #6
matglas86 CreditAttribution: matglas86 commentedMy patch did not apply. Sorry. Here is a new one.
Comment #7
matglas86 CreditAttribution: matglas86 commentedThe last upload did not work somehow.
Comment #8
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedif I do an update:
The following updates are pending:
addthis module :
7402 -
Do you wish to run all pending updates? (y/n): y
PHP Fatal error: Undefined class constant 'WIDGET_JS_LOAD_TYPE' in /var/aegir/platforms/7/modules/all/addthis/addthis.install on line 77
PHP Stack trace:
PHP 1. {main}() /usr/share/php/drush/drush.php:0
PHP 2. drush_main() /usr/share/php/drush/drush.php:16
PHP 3. _drush_bootstrap_and_dispatch() /usr/share/php/drush/drush.php:61
PHP 4. drush_dispatch() /usr/share/php/drush/drush.php:92
PHP 5. call_user_func_array() /usr/share/php/drush/includes/command.inc:175
PHP 6. drush_command() /usr/share/php/drush/includes/command.inc:175
PHP 7. _drush_invoke_hooks() /usr/share/php/drush/includes/command.inc:208
PHP 8. call_user_func_array() /usr/share/php/drush/includes/command.inc:334
PHP 9. drush_core_updatedb_batch_process() /usr/share/php/drush/includes/command.inc:334
PHP 10. _update_batch_command() /usr/share/php/drush/commands/core/core.drush.inc:1097
PHP 11. drush_batch_command() /usr/share/php/drush/commands/core/drupal/update_7.inc:246
PHP 12. _drush_batch_command() /usr/share/php/drush/includes/batch.inc:93
PHP 13. _drush_batch_worker() /usr/share/php/drush/commands/core/drupal/batch.inc:99
PHP 14. call_user_func_array() /usr/share/php/drush/commands/core/drupal/batch.inc:149
PHP 15. drush_update_do_one() /usr/share/php/drush/commands/core/drupal/batch.inc:149
PHP 16. addthis_update_7402() /usr/share/php/drush/commands/core/drupal/update_7.inc:73
Fatal error: Undefined class constant 'WIDGET_JS_LOAD_TYPE' in /var/aegir/platforms/7/modules/all/addthis/addthis.install on line 77
And the module is not updated.
where is Widget_js_load_type defined?
Comment #9
matglas86 CreditAttribution: matglas86 commentedI see the bug. I tried to remove the old variable. But that does not work as the static var with the key is removed from the AddThis class. I do need to fix that. The update statement should be changed to use the old key for WIDGET_JS_LOAD_TYPE.
Comment #10
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedI am only getting multiple js added to a page if I goto advanced, check the box, and add the addthis code.
Comment #11
matglas86 CreditAttribution: matglas86 commentedI updated some thing based on feedback I received in https://github.com/matglas/addthis/pull/4.
Here is a new patch.
Things that changed.
Comment #12
matglas86 CreditAttribution: matglas86 commentedThis is my latest patch. I'm ready to commit it. I tested upgrade from alpha4 without a problem.
Comment #14
matglas86 CreditAttribution: matglas86 commented