I'm trying to implement a feature of the AddThis facebook_like_counter so I can change the font as described on their site using fb:like:font="verdana" as an option in the link with class="addthis_button_facebook_like". How would I do this and still retain the rest of the settings in admin/settings/addthis? I just need to be able to change the font of the Facebook Like button without having to install yet another module.

Comments

Les Lim’s picture

Status: Active » Postponed

This is a problem I'm struggling with generally in developing this module. On the one hand, AddThis has a standardized API for its core functionality, and on the other, there are special features that each have their own unique configuration patterns. The trick is to design a theme system and UI that allows for configuring special cases while remaining easy to implement for the layperson. Ideas are welcome here.

For the moment, though, there's no way to do what you're asking from the settings. You'll have to override the theme_addthis_toolbox_item in your template.php file.

Les Lim’s picture

Title: Facebook Like Counter » Allow custom attributes in specific toolbox items
Status: Postponed » Active

Changed my mind on the status, and generalizing the title.

jacobroufa’s picture

Sounds good Les! Thanks for the tip, I'll throw up a new issue tagged with the Documentation component so others can benefit from the theme_addthis_toolbox_item function you mentioned. I've also been planning on hacking around in the module, so I may have some patches for you.

I think a good solution with regards to the special cases (which at the moment mostly leans on the FB Like) is to implement an expandable section towards the bottom of the module page, for now just calling it Facebook Like and only implementing those tags, where there is a text area that allows one API call per line with a link to a page or pages on AddThis' website in the helper text above or below the section. Also another section above that for more generalized API calls geared towards AddThis' standard functionality (for things like button graphic changes, et al).

Les Lim’s picture

Jacob, I created a new 3.0-beta1 release which has a new interface for making exactly the kind of customizations you were asking about. I'd love to get your opinions if you have some time to download it and see if you can get it to do what you want.

Les Lim’s picture

Status: Active » Fixed

I'm going to mark this as "fixed" to indicate that the feature is implemented, but I'd still welcome input, either here or in a new issue.

Status: Fixed » Closed (fixed)

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

jacobroufa’s picture

Status: Closed (fixed) » Reviewed & tested by the community

Hey Les, I finally got some time to try this. Amazing! I'm still having one issue though, in that I'd like to be able to make a drupal API call within the customization. Specifically - this customization og:image="$node->field_image[0]['filepath']" in the HTML Attributes field. I'd like for the filepath to actually turn into a path...

According to http://developers.facebook.com/docs/reference/plugins/like/ og:image pulls an image from the page into the "liked" item on someones Facebook feed. Right now when I'm liking some of the items on the site I'm developing I get this result http://img155.imageshack.us/i/episode.png/ and on other content types that don't have a video item, I get this (expected) result http://img263.imageshack.us/i/articlem.png/ . So as you can see, I'd like to be able to use an image field to feed what is shown on Facebook.

I hope this makes sense. How would I allow this field to use php in this way?

jacobroufa’s picture

Version: 6.x-3.x-dev » 6.x-3.0-beta1
Les Lim’s picture

Status: Reviewed & tested by the community » Active

I see your point, but I'm going to rule out evaluating PHP code from the interface. That's an invitation to trouble.

Initially I would think this might be addressed by token integration, although it would take some looking into. One problem is that since a toolbox can be displayed anywhere, you can't guarantee that there will be a node context from which to generate the tokens you want.

toemaz’s picture

Implement something like

function YOUR_MODULE_addthis_toolbox_services_alter(&$services) {
  
  if (isset($services['facebook_like'])) {
    $services['facebook_like']['attributes'] = ' fb:like:layout="button_count"';
  }
}

to add something to or change the attribute of a service.

Les Lim’s picture

Title: Allow custom attributes in specific toolbox items » Provide a way to use variables from node context within specific toolbox items
Version: 6.x-3.0-beta1 » 6.x-3.x-dev
Category: support » feature

toemaz: in this case, jacobroufa is asking for the ability to pull in contextual variables (from a node object, for example). There is no way to do that in the interface or the code, as of yet.

jacobroufa’s picture

Token support would be killer. That would probably be the best way to go about contextual variables... much safer than allowing PHP. Good thinking! Even though there wouldn't always be a single consistent context to pull from, I would assume site admins would at least know what they want to display where, and adjust tokens accordingly. Les, let me know what I can do to help with the Token integration. I'll be checking back here frequently. :)

I'd love to be able to do everything I need to within this one module; can't wait til this happens!! At the moment though, I'm having to use http://drupal.org/project/opengraph_meta in order to push OpenGraph data to FB, as I cannot do that within the module yet. You might recommend using this to other people, at least until token support is added.