You are here

function _addtoany_create_script in AddToAny Share Buttons 7.4

Same name and namespace in other branches
  1. 5.0 addtoany.module \_addtoany_create_script()
  2. 6.3 addtoany.module \_addtoany_create_script()
  3. 6.2 addtoany.module \_addtoany_create_script()
  4. 7 addtoany.module \_addtoany_create_script()
  5. 7.3 addtoany.module \_addtoany_create_script()

Internal function to call the async script loading function right after the first AddToAny instance, to utilize concurrent downloading and increase overall page-load performance.

Parameters

int $id_num:

string $link_name:

string $link_url:

Return value

String containing a JavaScript function call for asynchronous script loading right after the first instance.

1 call to _addtoany_create_script()
addtoany_create_buttons in ./addtoany.module
Generate code for AddToAny buttons.

File

./addtoany.module, line 246
Stand alone module file to handle AddToAny buttons integration

Code

function _addtoany_create_script($id_num, $link_name, $link_url) {
  global $_addtoany_targets, $_addtoany_init;
  if (!isset($_addtoany_targets)) {
    $_addtoany_targets = array();
  }
  $button_config = "\n{title:" . drupal_json_encode($link_name) . "," . "url:" . drupal_json_encode($link_url) . "}";
  $_addtoany_targets[] = $button_config;
  if (!$_addtoany_init) {
    $javascript_load_early = "<script type=\"text/javascript\">\n" . "<!--//--><![CDATA[//><!--\n" . "if(window.da2a)da2a.script_load();\n" . "//--><!]]>\n" . "</script>";
  }
  else {
    $javascript_load_early = "";
  }
  $_addtoany_init = TRUE;
  return $javascript_load_early;
}