Custom text/icons to social buttons
Closed this issue · 7 comments
Hi, can we have a custom buttons or text on the social buttons instead of using the default icons provided by font awesome. Thanks
Hi Fagray
I would love to add this, I would accept a PR to add this feature.
Joren
Hi Joren,
This is a very nice plugin. But I didn't find customization on social buttons. It will be great help if you incorporate this feature as well.
I'm also looking forward for this feature.
Thanks
Hi @ashish76
Glad you like the package. I'm a little short in time at the moment so I have no timeline for this feature. I'm open for a good PR to merge that implements this feature request.
Thanks
Joren
Well i don't know if this falls into customization but when we run
"php artisan vendor:publish --provider="Jorenvh\Share\Providers\ShareServiceProvider"
This will create Folders into resources from where we can add text to the button, but i'm sure you guiz already know that....and yeah one more thing if you're wanted to remove ( li ) then you can also change it
Here
Also, I wonder what else could be the case where we need dynamic names? Generally sharing is for a blog or any other content so I mean why would someone want to add more than two names to the sharable button?
if you want to remove suffix and prefix of default "ul" then
Here
A possible solution to tackling this request might be to do something like this;
In the config/laravel-share.php
to add a element called icon
to each of the services
Example:
'whatsapp' => [
'uri' => 'https://wa.me/?text=',
'extra' => ['mini' => 'true'],
'icon' => '<span class="fa fa-whatsapp"></span>'
],
Then in the resources/lang/en/laravel-share-fa4.php
add use the icon element in the following way;
'whatsapp' => '<li><a target="_blank" href=":url" class="social-button :class" id=":id">:icon</a></li>',
Once that is configured, we can modify the buildLink
function to "translate" the :icon
as defined the resources/lang/en/laravel-share-fa4.php
, to <span class="fa fa-whatsapp"></span>
.
This has some nice advantages, since it allows the consumer to totally customize the way the icons are present. He/She might choose to replace the span
element with custom SVG images or even go with a completely different icon library.
I don't understand why it was used <ul> <li>
...
Closing due to inactivity. I'm thinking on a new major version that will work in a different (more Laravelish) way.