You are here

function theme_addthis_toolbox in AddThis 6.3

Theme function to render an AddThis toolbox.

Parameters

$services: A comma-separated string of AddThis service codes to be rendered in the toolbox. If blank, the short list from the admin settings will be used.

array $config: An optional array of configuration options inherited by each item in the toolbox. A list of key/value possibilities can be found at http://addthis.com/help/menu-api

$more: If the pseudo-service "more" is included, this is the text or HTML used to represent the expanded menu in the toolbox. Defaults to "Share".

1 theme call to theme_addthis_toolbox()
addthis_handler_field_toolbox::render in ./addthis_handler_field.inc

File

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

Code

function theme_addthis_toolbox($services = NULL, $config = array()) {
  $default_config = variable_get('addthis_config', array());

  // If no services are passed to the function, use the configured defaults.
  if (empty($services)) {
    $services = explode(',', $default_config['services_toolbox']);
  }
  else {
    $services = explode(',', $services);
  }
  foreach ($services as $service) {
    $output .= theme('addthis_toolbox_item', trim(strtolower($service)));
  }

  // If a $config is specified, process it into $attributes.
  if (!empty($config) && is_array($config)) {
    foreach ($config as $key => $value) {
      $attributes .= sprintf("addthis:%s='%s' ", check_plain($key), check_plain($value));
    }
  }
  $toolbox_classes = check_plain(variable_get('addthis_toolbox_classes', ''));
  return "<div class='addthis_toolbox addthis_default_style {$toolbox_classes}' {$attributes}>" . $output . "</div>";
}