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.

CommentFileSizeAuthor
#3 addthis_wrong_alter-2865046-3.patch980 bytesBaysaa
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Baysaa created an issue. See original summary.

Baysaa’s picture

Title: Alter of addthis_configuration_share (AddThisScriptManager.php) should share alter $addthis_share instead of $configuration » Alter of addthis_configuration_share (AddThisScriptManager.php) should alter $addthis_share instead of $configuration
Baysaa’s picture

Status: Active » Needs review
FileSize
980 bytes
loziju’s picture

Patch in #3 is confirmed working.