Currently, the theme_sharethis function in sharethis.module defines the span attributes without allowing them to be extended or overridden in a custom implementation. I would like to present a solution which allows a developer to override the span attributes in a custom theme_sharethis implementation.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jpcondon created an issue. See original summary.

jpcondon’s picture

Status: Active » Needs review
FileSize
925 bytes

Here is a patch that modifies the attributes array within theme_sharethis in the sharethis.module to put it within the variables array. This creates the ability for modules to add their own implementations of theme_sharethis and pass the attributes array to the function with any overrides they may need based on their use case. Some examples include adding st_summary and st_image attributes or overriding the default st_title and st_url implementations.

Nitesh Sethia’s picture

Assigned: jpcondon » Unassigned
Status: Needs review » Reviewed & tested by the community

This patch works as expected. So changing the status of it to Reviewed and Tested by community so that we can port this patch in the next release of Sharethis module.

purushotam.rai’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

purushotam.rai’s picture

Status: Patch (to be ported) » Fixed
navneet0693’s picture

Status: Fixed » Needs work
FileSize
138.81 KB

Throws certain errors.

navneet0693’s picture

+++ b/sharethis.module
@@ -572,12 +572,13 @@ function theme_sharethis($variables) {
+    $attributes = $variables['attributes'];

This will lead to undefined index error. Also, I didn't understood the it must be: $variables['attributes'] = $attributes

navneet0693’s picture

navneet0693’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work
navneet0693’s picture

Status: Needs work » Needs review
yogeshmpawar’s picture

Patch is working fine & errors are gone.

yogeshmpawar’s picture

Status: Needs review » Reviewed & tested by the community
naveenvalecha’s picture

Version: 7.x-2.12 » 7.x-2.x-dev

patches always automated tested against the branches.

purushotam.rai’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.