You are here

function _easy_social_widget_twitter_markup in Easy Social 7.2

Generate the needed markup for the twitter share link.

Parameters

$url The url to be shared:

$type Generate horizontal or vertical widgets:

$title The title to be shared:

$lang The language of the twitter button:

Return value

string the html markup

1 string reference to '_easy_social_widget_twitter_markup'
easy_social_easy_social_widget in ./easy_social.module
Implements hook_easy_social_widget().

File

includes/easy_social.widgets.inc, line 150
Easy Social default widget functions.

Code

function _easy_social_widget_twitter_markup($url, $type, $title = NULL, $lang = 'und') {

  // Correct for different language identification strings.
  $lang = _easy_social_twitter_langcodes($lang);
  $type = $type == EASY_SOCIAL_WIDGET_HORIZONTAL ? 'horizontal' : 'vertical';

  // Override the data-count attribute to hide the count, if selected.
  $type_show = variable_get_value('easy_social_twitter_count_show');
  if (!$type_show) {
    $type = 'none';
  }
  $account_via = variable_get_value('easy_social_twitter_account_via');
  $account_related = variable_get_value('easy_social_twitter_account_related');
  $account_related_description = variable_get_value('easy_social_twitter_account_description');
  $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>}"
data-text="{<span class="php-variable">$title</span>}">Tweet</a>
TT;
  return $markup;
}