You are here

private function AddThisScriptManager::getJsAddThisConfig in AddThis 7.4

Get a array with all addthis_config values.

Allow alter through 'addthis_configuration'.

@todo Add static cache.

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

2 calls to AddThisScriptManager::getJsAddThisConfig()
AddThisScriptManager::attachJsToElement in classes/Services/AddThisScriptManager.php
Attach the widget js to the element.
AddThisScriptManager::getJsAddThisShare in classes/Services/AddThisScriptManager.php
Get a array with all addthis_share values.

File

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

Class

AddThisScriptManager
@file Class definition of a script manager.

Code

private function getJsAddThisConfig() {
  global $language;
  $enabled_services = $this->addthis
    ->getServiceNamesAsCommaSeparatedString($this->addthis
    ->getEnabledServices()) . 'more';
  $excluded_services = $this->addthis
    ->getServiceNamesAsCommaSeparatedString($this->addthis
    ->getExcludedServices());
  $configuration = array(
    'pubid' => $this->addthis
      ->getProfileId(),
    'services_compact' => $enabled_services,
    'services_exclude' => $excluded_services,
    'data_track_clickback' => $this->addthis
      ->isClickbackTrackingEnabled(),
    'ui_508_compliant' => $this->addthis
      ->get508Compliant(),
    'ui_click' => $this->addthis
      ->isClickToOpenCompactMenuEnabled(),
    'ui_cobrand' => $this->addthis
      ->getCoBrand(),
    'ui_delay' => $this->addthis
      ->getUiDelay(),
    'ui_header_background' => $this->addthis
      ->getUiHeaderBackgroundColor(),
    'ui_header_color' => $this->addthis
      ->getUiHeaderColor(),
    'ui_open_windows' => $this->addthis
      ->isOpenWindowsEnabled(),
    'ui_use_css' => $this->addthis
      ->isStandardCssEnabled(),
    'ui_use_addressbook' => $this->addthis
      ->isAddressbookEnabled(),
    'ui_language' => $language->language,
  );
  if (module_exists('googleanalytics')) {
    if ($this->addthis
      ->isGoogleAnalyticsTrackingEnabled()) {
      $configuration['data_ga_property'] = variable_get('googleanalytics_account', '');
      $configuration['data_ga_social'] = $this->addthis
        ->isGoogleAnalyticsSocialTrackingEnabled();
    }
  }
  drupal_alter('addthis_configuration', $configuration);
  return $configuration;
}