quadstat_misc-8.x-1.x-dev/templates/social-share-link-twitter.html.twig
templates/social-share-link-twitter.html.twig
{#
/**
* @file
* Default theme implementation to display a social share link.
*
* Available variables:
* - attributes: array of HTML attributes populated by modules, intended to
* be added to the main container tag of this template.
* - twitter_link_text: The sharing link text.
* - shared_text: The text to share.
*
* See \Drupal\social_share\Plugin\SocialShareLink\TwitterShareLink() for a
* a complete list of supported variables. Every context defind by the plugin
* is made available as variable.
*
* @see https://dev.twitter.com/web/tweet-button/web-intent
*
* @ingroup themeable
*/
#}
{{ attach_library('social_share/popup') }}
{% if twitter_url == '<current>' %}
{% set twitter_url = url('<current>')|render|striptags %}
{% endif %}
{% set url_params = {
'text': shared_text,
'url': twitter_url,
'hashtags': hashtags,
'via': twitter_via,
'related': twitter_related,
'in-reply-to': twitter_reply_to,
}
%}
{% set attributes = attributes.
setAttribute('target', '_blank').
setAttribute('data-popup-height', '300').
setAttribute('data-popup-width', '500').
addClass('js-social-share-popup')
%}
<div class="social_share_link button twitter">
<a href="https://twitter.com/intent/tweet/?{{ url_params|url_encode }}" {{ attributes.addClass('social-share-twitter') }}>
<i class="fa fa-twitter"></i> {{ twitter_link_text }}
</a>
</div>
