Provider
A provider represents one social media platform, such as Facebook or LinkedIn. It holds the platform’s name, brand colour and icon, and creates the buttons and share links for it. Get a provider by its handle, or loop over the providers that support a feature.
{% for provider in craft.socialShare.getShareButtonProviders() %}
{{ provider.renderShareButton({ url: entry.url }) }}
{% endfor %}
{% set facebook = craft.socialShare.getProvider('facebook') %}
<a href="{{ facebook.getShareUrl(entry.url) }}">Share on {{ facebook.name }}</a>
Properties
The provider’s name, such as Facebook, used as the button label. This reads getName().
The provider’s handle, such as facebook, used to fetch it in templates.
The provider’s brand colour as a hex value, or null when it has none.
The provider’s icon as SVG markup, or null when it has none.
The URL to edit the provider’s settings in the control panel.
Methods
Returns whether the provider has the settings it needs, such as API credentials, to fetch follower or share counts.
Returns: string|null
Returns the link that shares a URL on the provider, or null when the provider doesn’t support sharing.
Returns: verbb\socialshare\models\ShareButton|null
Returns a Share Button for the provider, without rendering it.
Returns: Twig\Markup|null
Returns the HTML for a Share Button for the provider.
Returns: verbb\socialshare\models\Button|null
Returns a Button for the provider, without rendering it.
Returns: Twig\Markup|null
Returns the HTML for a Button for the provider.