You are here

function theme_addthis_button in AddThis 6.3

Same name and namespace in other branches
  1. 6.2 addthis.module \theme_addthis_button()
  2. 7.2 addthis.module \theme_addthis_button()

Theme function to render an AddThis button.

Parameters

$html: HTML code to be placed inside the <a> element that will become the AddThis button. If blank, AddThis will use its own default button image.

array $config: An optional array of configuration options to apply to this instance of the button. A list of key/value possibilities can be found at http://addthis.com/help/menu-api. Options from both addthis_config and addthis_share may be used.

1 theme call to theme_addthis_button()
addthis_handler_field_button::render in ./addthis_handler_field.inc

File

./addthis.module, line 148
Provides integration with the AddThis.com bookmarking & sharing service.

Code

function theme_addthis_button($html = NULL, $config = array()) {
  addthis_add_default_js();

  // Build the button attributes, including those provided in $config.
  $attributes = array(
    'class' => 'addthis_button',
  );
  if (!empty($config) && is_array($config)) {
    foreach ($config as $key => $value) {
      $attributes['addthis:' . check_plain($key)] = check_plain($value);
    }
  }
  $output = l(filter_xss_admin($html), NULL, array(
    'html' => TRUE,
    'attributes' => $attributes,
  ));
  return $output;
}