better-social-sharing-buttons.html.twig in Better Social Sharing Buttons 8.3
{{ attach_library('better_social_sharing_buttons/styling') }} {% if items.width %} {% set width = items.width ? 'width=' ~ items.width ~'' %} {% set height = items.width ? 'height=' ~ items.width ~'' %} {% endif %} {% if items.radius %} {% set radius = items.radius ? 'style=border-radius:' ~ items.radius ~';' %} {% endif %} {# --- Include svg sprite --- #} <div style="display: none">{% include social_buttons_sprite %}</div> <div class="social-sharing-buttons"> <!-- Facebook share button --> {% if items.services.facebook %} <a href="https://www.facebook.com/sharer/sharer.php?u={{ items.page_url }}&title={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Facebook" aria-label="{{ 'Share to'|t }} Facebook" class="social-sharing-buttons__button share-facebook" rel="noopener"> <svg {{ width }} {{ height }} {{ radius }}> <use href="{{ social_buttons_sprite }}#facebook" /> </svg> </a> {% endif %} <!-- Twitter share button --> {% if items.services.twitter %} <a href="http://twitter.com/intent/tweet?text={{ items.title }}+{{ items.page_url }}" target="_blank" title="{{ 'Share to'|t }} Twitter" aria-label="{{ 'Share to'|t }} Twitter" class="social-sharing-buttons__button share-twitter" rel="noopener"> <svg {{ width }} {{ height }} {{ radius }}> <use href="{{ social_buttons_sprite }}#twitter" /> </svg> </a> {% endif %} <!-- WhatsApp share button --> {% if items.services.whatsapp %} <a href="https://wa.me/?text={{ items.page_url }}" target="_blank" title="{{ 'Share to'|t }} WhatsApp" aria-label="{{ 'Share to'|t }} WhatsApp" class="social-sharing-buttons__button share-whatsapp" rel="noopener"> <svg {{ width }} {{ height }} {{ radius }}> <use href="{{ social_buttons_sprite }}#whatsapp" /> </svg> </a> {% endif %} <!-- Facebook Messenger share button --> {% if items.services.facebook_messenger %} <a href="http://www.facebook.com/dialog/send?app_id={{ items.facebook_app_id }}&link={{ items.page_url }}&redirect_uri={{ url('<current>') }}" target="_blank" title="{{ 'Share to'|t }} Facebook Messenger" aria-label="{{ 'Share to'|t }} Facebook Messenger" class="social-sharing-buttons__button share-facebook-messenger" rel="noopener"> <svg {{ width }} {{ height }} {{ radius }}> <use href="{{ social_buttons_sprite }}#messenger" /> </svg> </a> {% endif %} <!-- Pinterest share button --> {% if items.services.pinterest %} <a href="http://pinterest.com/pin/create/link/?url={{ items.page_url }}&description={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Pinterest" aria-label="{{ 'Share to'|t }} Pinterest" class="social-sharing-buttons__button share-pinterest" rel="noopener"> <svg {{ width }} {{ height }} {{ radius }}> <use href="{{ social_buttons_sprite }}#pinterest" /> </svg> </a> {% endif %} <!-- Linkedin share button --> {% if items.services.linkedin %} <a href="https://www.linkedin.com/sharing/share-offsite/?url={{ items.page_url }}" target="_blank" title="{{ 'Share to'|t }} Linkedin" aria-label="{{ 'Share to'|t }} Linkedin" class="social-sharing-buttons__button share-linkedin" rel="noopener"> <svg {{ width }} {{ height }} {{ radius }}> <use href="{{ social_buttons_sprite }}#linkedin" /> </svg> </a> {% endif %} <!-- Digg share button --> {% if items.services.digg %} <a href="http://www.digg.com/submit?phase=2&url={{ items.page_url }}&title={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Digg" aria-label="{{ 'Share to'|t }} Digg" class="social-sharing-buttons__button share-digg" rel="noopener"> <svg {{ width }} {{ height }} {{ radius }}> <use href="{{ social_buttons_sprite }}#digg" /> </svg> </a> {% endif %} <!-- Tumblr share button --> {% if items.services.tumblr %} <a href="http://www.tumblr.com/share?v=3&u={{ items.page_url }}&t={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Tumblr" aria-label="{{ 'Share to'|t }} Tumblr" class="social-sharing-buttons__button share-tumblr" rel="noopener"> <svg {{ width }} {{ height }} {{ radius }}> <use href="{{ social_buttons_sprite }}#tumblr" /> </svg> </a> {% endif %} <!-- Reddit share button --> {% if items.services.reddit %} <a href="http://www.reddit.com/submit?url={{ items.page_url }}&title={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Reddit" aria-label="{{ 'Share to'|t }} Reddit" class="social-sharing-buttons__button share-reddit" rel="noopener"> <svg {{ width }} {{ height }} {{ radius }}> <use href="{{ social_buttons_sprite }}#reddit" /> </svg> </a> {% endif %} <!-- Evernote share button --> {% if items.services.evernote %} <a href="http://www.evernote.com/clip.action?url={{ items.page_url }}&title={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Evernote" aria-label="{{ 'Share to'|t }} Evernote" class="social-sharing-buttons__button share-evernote" rel="noopener"> <svg {{ width }} {{ height }} {{ radius }}> <use href="{{ social_buttons_sprite }}#evernote" /> </svg> </a> {% endif %} <!-- Email share button --> {% if items.services.email %} <a href="mailto:?subject={{ items.title }}&body={{ items.page_url }}" title="{{ 'Share to'|t }} Email" aria-label="{{ 'Share to'|t }} Email" class="social-sharing-buttons__button share-email" target="_blank" rel="noopener"> <svg {{ width }} {{ height }} {{ radius }}> <use href="{{ social_buttons_sprite }}#email" /> </svg> </a> {% endif %} <!-- Copy link share button --> {% if items.services.copy %} {{ attach_library('better_social_sharing_buttons/copy-current-url') }} <a class="btnCopy social-sharing-buttons__button share-copy"> <svg {{ width }} {{ height }} {{ radius }}> <use href="{{ social_buttons_sprite }}#copy" /> </svg> <div class="social-sharing-buttons__popup">{{ 'Copied to clipboard'|t }}</div> </a> {% endif %} <!-- Print share button --> {% if items.services.print %} {% if items.print_css %} {% set href = "#" %} {% set rel = items.print_css %} {{ attach_library('better_social_sharing_buttons/print-css') }} {% else %} {% set href = "javascript:window.print()" %} {% endif %} <a href="{{ href }}" rel="{{ rel }}" id="printlink" class="share-print"> <svg {{ width }} {{ height }} {{ radius }}> <use href="{{ social_buttons_sprite }}#print" /> </svg> </a> {% endif %} </div>
2 theme calls to better-social-sharing-buttons.html.twig
- better_social_sharing_buttons_node_view in ./
better_social_sharing_buttons.module - Implements hook_ENTITY_TYPE_view().
- SocialSharingButtonsBlock::build in src/
Plugin/ Block/ SocialSharingButtonsBlock.php - Builds and returns the renderable array for this block plugin.
File
templates/better-social-sharing-buttons.html.twigView source
- {{ attach_library('better_social_sharing_buttons/styling') }}
-
- {% if items.width %}
- {% set width = items.width ? 'width=' ~ items.width ~'' %}
- {% set height = items.width ? 'height=' ~ items.width ~'' %}
- {% endif %}
-
- {% if items.radius %}
- {% set radius = items.radius ? 'style=border-radius:' ~ items.radius ~';' %}
- {% endif %}
-
- {# --- Include svg sprite --- #}
- <div style="display: none">{% include social_buttons_sprite %}</div>
-
- <div class="social-sharing-buttons">
- <!-- Facebook share button -->
- {% if items.services.facebook %}
- <a href="https://www.facebook.com/sharer/sharer.php?u={{ items.page_url }}&title={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Facebook" aria-label="{{ 'Share to'|t }} Facebook" class="social-sharing-buttons__button share-facebook" rel="noopener">
- <svg {{ width }} {{ height }} {{ radius }}>
- <use href="{{ social_buttons_sprite }}#facebook" />
- </svg>
- </a>
- {% endif %}
-
- <!-- Twitter share button -->
- {% if items.services.twitter %}
- <a href="http://twitter.com/intent/tweet?text={{ items.title }}+{{ items.page_url }}" target="_blank" title="{{ 'Share to'|t }} Twitter" aria-label="{{ 'Share to'|t }} Twitter" class="social-sharing-buttons__button share-twitter" rel="noopener">
- <svg {{ width }} {{ height }} {{ radius }}>
- <use href="{{ social_buttons_sprite }}#twitter" />
- </svg>
- </a>
- {% endif %}
-
- <!-- WhatsApp share button -->
- {% if items.services.whatsapp %}
- <a href="https://wa.me/?text={{ items.page_url }}" target="_blank" title="{{ 'Share to'|t }} WhatsApp" aria-label="{{ 'Share to'|t }} WhatsApp" class="social-sharing-buttons__button share-whatsapp" rel="noopener">
- <svg {{ width }} {{ height }} {{ radius }}>
- <use href="{{ social_buttons_sprite }}#whatsapp" />
- </svg>
- </a>
- {% endif %}
-
- <!-- Facebook Messenger share button -->
- {% if items.services.facebook_messenger %}
- <a href="http://www.facebook.com/dialog/send?app_id={{ items.facebook_app_id }}&link={{ items.page_url }}&redirect_uri={{ url('<current>') }}" target="_blank" title="{{ 'Share to'|t }} Facebook Messenger" aria-label="{{ 'Share to'|t }} Facebook Messenger" class="social-sharing-buttons__button share-facebook-messenger" rel="noopener">
- <svg {{ width }} {{ height }} {{ radius }}>
- <use href="{{ social_buttons_sprite }}#messenger" />
- </svg>
- </a>
- {% endif %}
-
- <!-- Pinterest share button -->
- {% if items.services.pinterest %}
- <a href="http://pinterest.com/pin/create/link/?url={{ items.page_url }}&description={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Pinterest" aria-label="{{ 'Share to'|t }} Pinterest" class="social-sharing-buttons__button share-pinterest" rel="noopener">
- <svg {{ width }} {{ height }} {{ radius }}>
- <use href="{{ social_buttons_sprite }}#pinterest" />
- </svg>
- </a>
- {% endif %}
-
- <!-- Linkedin share button -->
- {% if items.services.linkedin %}
- <a href="https://www.linkedin.com/sharing/share-offsite/?url={{ items.page_url }}" target="_blank" title="{{ 'Share to'|t }} Linkedin" aria-label="{{ 'Share to'|t }} Linkedin" class="social-sharing-buttons__button share-linkedin" rel="noopener">
- <svg {{ width }} {{ height }} {{ radius }}>
- <use href="{{ social_buttons_sprite }}#linkedin" />
- </svg>
- </a>
- {% endif %}
-
- <!-- Digg share button -->
- {% if items.services.digg %}
- <a href="http://www.digg.com/submit?phase=2&url={{ items.page_url }}&title={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Digg" aria-label="{{ 'Share to'|t }} Digg" class="social-sharing-buttons__button share-digg" rel="noopener">
- <svg {{ width }} {{ height }} {{ radius }}>
- <use href="{{ social_buttons_sprite }}#digg" />
- </svg>
- </a>
- {% endif %}
-
- <!-- Tumblr share button -->
- {% if items.services.tumblr %}
- <a href="http://www.tumblr.com/share?v=3&u={{ items.page_url }}&t={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Tumblr" aria-label="{{ 'Share to'|t }} Tumblr" class="social-sharing-buttons__button share-tumblr" rel="noopener">
- <svg {{ width }} {{ height }} {{ radius }}>
- <use href="{{ social_buttons_sprite }}#tumblr" />
- </svg>
- </a>
- {% endif %}
-
- <!-- Reddit share button -->
- {% if items.services.reddit %}
- <a href="http://www.reddit.com/submit?url={{ items.page_url }}&title={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Reddit" aria-label="{{ 'Share to'|t }} Reddit" class="social-sharing-buttons__button share-reddit" rel="noopener">
- <svg {{ width }} {{ height }} {{ radius }}>
- <use href="{{ social_buttons_sprite }}#reddit" />
- </svg>
- </a>
- {% endif %}
-
- <!-- Evernote share button -->
- {% if items.services.evernote %}
- <a href="http://www.evernote.com/clip.action?url={{ items.page_url }}&title={{ items.title }}" target="_blank" title="{{ 'Share to'|t }} Evernote" aria-label="{{ 'Share to'|t }} Evernote" class="social-sharing-buttons__button share-evernote" rel="noopener">
- <svg {{ width }} {{ height }} {{ radius }}>
- <use href="{{ social_buttons_sprite }}#evernote" />
- </svg>
- </a>
- {% endif %}
-
- <!-- Email share button -->
- {% if items.services.email %}
- <a href="mailto:?subject={{ items.title }}&body={{ items.page_url }}" title="{{ 'Share to'|t }} Email" aria-label="{{ 'Share to'|t }} Email" class="social-sharing-buttons__button share-email" target="_blank" rel="noopener">
- <svg {{ width }} {{ height }} {{ radius }}>
- <use href="{{ social_buttons_sprite }}#email" />
- </svg>
- </a>
- {% endif %}
-
- <!-- Copy link share button -->
- {% if items.services.copy %}
- {{ attach_library('better_social_sharing_buttons/copy-current-url') }}
- <a class="btnCopy social-sharing-buttons__button share-copy">
- <svg {{ width }} {{ height }} {{ radius }}>
- <use href="{{ social_buttons_sprite }}#copy" />
- </svg>
- <div class="social-sharing-buttons__popup">{{ 'Copied to clipboard'|t }}</div>
- </a>
- {% endif %}
-
- <!-- Print share button -->
- {% if items.services.print %}
- {% if items.print_css %}
- {% set href = "#" %}
- {% set rel = items.print_css %}
- {{ attach_library('better_social_sharing_buttons/print-css') }}
- {% else %}
- {% set href = "javascript:window.print()" %}
- {% endif %}
- <a href="{{ href }}" rel="{{ rel }}" id="printlink" class="share-print">
- <svg {{ width }} {{ height }} {{ radius }}>
- <use href="{{ social_buttons_sprite }}#print" />
- </svg>
- </a>
- {% endif %}
- </div>