You are here

function _easysocial_button_twitter_markup in Easy Social 6

Same name and namespace in other branches
  1. 7 easy_social.module \_easysocial_button_twitter_markup()

Generate the needed markup for the twitter share link

Parameters

$url The url to be shared:

$type Generate horizontal or vertical widgets:

Return value

the html markup

File

./easy_social.module, line 426
This is the file description for Easy Social module.

Code

function _easysocial_button_twitter_markup($url, $type, $lang = 'en') {

  // correct for different language identification strings
  if ($lang === 'en-gb') {
    $lang = 'en';
  }
  elseif ($lang === 'pt-br' || $lang === 'pt-pt') {
    $lang = 'pt';
  }
  $type = $type == 0 ? 'horizontal' : 'vertical';
  $account_via = variable_get('easysocial_tt_global_account_via', '');
  $account_related = variable_get('easysocial_tt_global_account_related', '');
  $account_related_description = variable_get('easysocial_tt_global_account_description', '');

  // Twitter uses current page title by default
  $markup = <<<TT
    <a href="http://twitter.com/share"
    class="twitter-share-button"
    data-url="{<span class="php-variable">$url</span>}"
    data-count="{<span class="php-variable">$type</span>}"
    data-lang = "{<span class="php-variable">$lang</span>}"
    data-via="{<span class="php-variable">$account_via</span>}"
    data-related="{<span class="php-variable">$account_related</span>}:{<span class="php-variable">$account_related_description</span>}">Tweet</a>
TT;
  return $markup;
}