You are here

function theme_easy_social_pinterest in Easy Social 8.3

Same name and namespace in other branches
  1. 8.4 easy_social.theme.inc \theme_easy_social_pinterest()

Returns HTML for the Easy Social Pinterest widget.

File

./easy_social.theme.inc, line 12
Easy Social theme functions.

Code

function theme_easy_social_pinterest($variables) {
  $attributes = array(
    'class' => array(
      'pinterest-share',
    ),
    'data-pin-do' => 'buttonPin',
  );
  $attributes['data-pin-config'] = $variables['config'];
  $build = array(
    '#theme' => 'link',
    '#text' => '<img src="//assets.pinterest.com/images/pidgets/pin_it_button.png" />',
    '#path' => '/pinterest.com/pin/create/button',
    '#options' => array(
      'attributes' => $attributes,
      'html' => TRUE,
      'query' => array(
        'url' => $variables['url'],
        'media' => $variables['image'],
        'description' => $variables['description'],
      ),
    ),
    '#prefix' => "\n" . '<span class="easy-social pinterest">',
    '#suffix' => '</span>',
  );
  return \Drupal::service('renderer')
    ->render($build);
}