You are here

public function SharethisManager::getShareThisLightOptions in ShareThis 8.2

Function is creating options to be passed to stLight.

Parameters

array $data_options: The settings selected by publisher in admin panel.

Return value

array An array of options.

Overrides SharethisManagerInterface::getShareThisLightOptions

1 call to SharethisManager::getShareThisLightOptions()
SharethisManager::sharethisIncludeJs in src/SharethisManager.php
Include st js scripts.

File

src/SharethisManager.php, line 172

Class

SharethisManager
Defines an SharethisManager service.

Namespace

Drupal\sharethis

Code

public function getShareThisLightOptions(array $data_options) {

  // Provide the publisher ID.
  $params_stlight = [
    'publisher' => $data_options['publisherID'],
  ];
  $params_stlight['version'] = $data_options['widget'] == 'st_multi' ? '5x' : '4x';
  if ($data_options['callesi'] == 0) {
    $params_stlight['doNotCopy'] = !$this
      ->toBoolean($data_options['cns']['donotcopy']);
    $params_stlight['hashAddressBar'] = $this
      ->toBoolean($data_options['cns']['hashaddress']);
    if (!$params_stlight['hashAddressBar'] && $params_stlight['doNotCopy']) {
      $params_stlight['doNotHash'] = TRUE;
    }
    else {
      $params_stlight['doNotHash'] = FALSE;
    }
  }
  if (isset($data_options['onhover']) && $data_options['onhover'] == FALSE) {
    $params_stlight['onhover'] = FALSE;
  }
  if ($data_options['neworzero']) {
    $params_stlight['newOrZero'] = 'zero';
  }
  if (!$data_options['shorten']) {
    $params_stlight['shorten'] = 'false';
  }
  return $params_stlight;
}