You are here

function _addthis_create_button in AddThis 7.2

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

Internal function to generate code for AddThis button

Return value

String containing html code for the button

3 calls to _addthis_create_button()
addthis_block_view in ./addthis.module
Implement hook_block_view();
addthis_handler_field_service_links::render in ./addthis_handler_field_service_links.inc
Render the field.
addthis_node_view in ./addthis.module
Implement hook_node_view().

File

./addthis.module, line 123
Stand alone module file to handle AddThis button integration

Code

function _addthis_create_button($build_mode) {
  global $_addthis_counter;
  $_addthis_counter++;
  if ($_addthis_counter == 1) {
    drupal_add_css(drupal_get_path('module', 'addthis') . '/addthis.css');
    drupal_add_js(sprintf('
	    addthis_pub = \'%s\';
	    addthis_logo = \'%s\';
	    addthis_logo_background = \'%s\';
	    addthis_logo_color = \'%s\';
	    addthis_brand = \'%s\';
	    addthis_options = \'%s\';
	    addthis_disable_flash = \'%s\';
	', addslashes(check_plain(variable_get('addthis_username', 'my-username'))), addslashes(check_plain(variable_get('addthis_logo', 'http://www.addthis.com/images/yourlogo.png'))), addslashes(check_plain(variable_get('addthis_logo_background', 'EFEFFF'))), addslashes(check_plain(variable_get('addthis_logo_color', '666699'))), addslashes(check_plain(variable_get('addthis_brand', 'Your Site'))), addslashes(check_plain(variable_get('addthis_options', 'favorites, email, digg, delicious, myspace, facebook, google, live, more'))), variable_get('addthis_options', FALSE) ? 'true' : 'false'), 'inline');
  }
  return theme('addthis_button', array(
    'build_mode' => $build_mode,
  ));
}