quadstat_misc-8.x-1.x-dev/templates/social-share-link-facebook.html.twig
templates/social-share-link-facebook.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.
* - facebook_link_text: The sharing link text.
* - title: The title of the shared item.
* - description: The description text to use for sharing.
* - caption: The caption used for sharing.
* - url: The url to link to.
* - media_url: The url of the image to use for sharing.
* - description: The description text to use for sharing.
* - app_id: The facebook app_id.
*
* See \Drupal\social_share\Plugin\SocialShareLink\FacebookShareLink() for a
* a complete list of supported variables. Every context defind by the plugin
* is made available as variable.
*
* See https://developers.facebook.com/docs/sharing/reference/feed-dialog for
* the facebook API documentation.
*
* @ingroup themeable
*/
#}
{{ attach_library('social_share/popup') }}
{% set url_params = {
'app_id': facebook_app_id,
'name': title,
'link': url|default(url('<current>')|render|striptags),
'caption': caption,
'description': description,
'picture': media_image_url|default(media_url),
'source': media_url,
'ref': facebook_ref,
'display': 'popup',
}
%}
{% set attributes = attributes.
setAttribute('target', '_blank').
setAttribute('data-popup-height', '450').
addClass('js-social-share-popup')
%}
<div class="social_share_link button facebook">
<a href="https://www.facebook.com/dialog/feed?{{ url_params|url_encode }}" {{ attributes.addClass('social-share-facebook') }}>
<i class="fa fa-facebook"></i> {{ facebook_link_text }}
</a>
</div>
