I tried to implement hook_addthis_configuration_share_alter() today, and found that the argument variable is the wrong one.
Line 228 at /classes/Services/AddThisScriptManager.php (AddThisScriptManager::getJsAddThisShare()):
drupal_alter('addthis_configuration_share', $configuration);
This $configuration variable comes from AddThisScriptManager::getJsAddThisConfig() and seems to be only used for setting $addthis_share['templates']. Add to that, the fact that there's already an alter hook in AddThisScriptManager::getJsAddThisConfig() to alter $configuration before it's returned to the caller, it seems to me that the code referenced above is probably just a copy-paste typo, and should in fact be trying to alter $addthis_share:
drupal_alter('addthis_configuration_share', $addthis_share);
In fact, that whole function probably needs a slight refactoring, as $addthis_share can be undeclared when the function tries to return it. Submitting a patch soon.
Comment | File | Size | Author |
---|---|---|---|
#3 | addthis_wrong_alter-2865046-3.patch | 980 bytes | Baysaa |
Comments
Comment #2
Baysaa CreditAttribution: Baysaa commentedComment #3
Baysaa CreditAttribution: Baysaa commentedComment #4
loziju CreditAttribution: loziju at Pixel Onion Pte Ltd commentedPatch in #3 is confirmed working.