You are here

private function AddThisScriptManager::getJsAddThisShare in AddThis 7.4

Get a array with all addthis_share values.

Allow alter through 'addthis_configuration_share'.

@todo Add static cache.

@todo Make the adding of configuration dynamic. SRP is lost here.

1 call to AddThisScriptManager::getJsAddThisShare()
AddThisScriptManager::attachJsToElement in classes/Services/AddThisScriptManager.php
Attach the widget js to the element.

File

classes/Services/AddThisScriptManager.php, line 219
Class definition of a script manager.

Class

AddThisScriptManager
@file Class definition of a script manager.

Code

private function getJsAddThisShare() {
  $configuration = $this
    ->getJsAddThisConfig();
  if (isset($configuration['templates'])) {
    $addthis_share = array(
      'templates' => $configuration['templates'],
    );
  }
  $twitter_via = $this->addthis
    ->getTwitterVia();
  if (!empty($twitter_via)) {
    $addthis_share['passthrough']['twitter']['via'] = $twitter_via;
  }
  $twitter_text = $this->addthis
    ->getTwitterText();
  if (!empty($twitter_text)) {
    $addthis_share['passthrough']['twitter']['text'] = $twitter_text;
  }
  drupal_alter('addthis_configuration_share', $configuration);
  return $addthis_share;
}