Yii2 widget for popular social networks "share link" generation
Links ¶
Supported Social Networks ¶
Installation via Composer ¶
add to require section of your composer.json
"ijackua/yii2-sharelinks-widget": "dev-master"
and run composer update
Usage Example ¶
\ijackua\sharelinks\ShareLinks::widget(
[
'viewName' => '@app/views/mypath/shareLinks.php' //custom view file for you links appearance
]
);
Example view file ¶
it uses custom icons from Fontello, but you can make it what ever you want and customize what links do you need adn what not
<?php
use ijackua\sharelinks\ShareLinks;
use \yii\helpers\Html;
/**
* @var yii\base\View $this
*/
?>
<div class="socialShareBlock">
<?=
Html::a('<i class="icon-facebook-squared"></i>', $this->context->shareUrl(ShareLinks::SOCIAL_FACEBOOK),
['title' => 'Share to Facebook']) ?>
<?=
Html::a('<i class="icon-twitter-squared"></i>', $this->context->shareUrl(ShareLinks::SOCIAL_TWITTER),
['title' => 'Share to Twitter']) ?>
<?=
Html::a('<i class="icon-linkedin-squared"></i>', $this->context->shareUrl(ShareLinks::SOCIAL_LINKEDIN),
['title' => 'Share to LinkedIn']) ?>
<?=
Html::a('<i class="icon-gplus-squared"></i>', $this->context->shareUrl(ShareLinks::SOCIAL_GPLUS),
['title' => 'Share to Google Plus']) ?>
<?=
Html::a('<i class="icon-vkontakte"></i>', $this->context->shareUrl(ShareLinks::SOCIAL_VKONTAKTE),
['title' => 'Share to Vkontakte']) ?>
<?=
Html::a('<i class="icon-tablet"></i>', $this->context->shareUrl(ShareLinks::SOCIAL_KINDLE),
['title' => 'Send to Kindle']) ?>
</div>
User Contributed Notes 2
Error to execute "composer update"
it doesn't work, when I use composer update:
Your requirements could not be resolved to an installable set of packages. Problem 1 - yiisoft/yii2 2.0.6 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found. - yiisoft/yii2 2.0.5 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found. - yiisoft/yii2 2.0.4 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found. - yiisoft/yii2 2.0.5 requires bower-asset/jquery 2.1.*@stable | 1.11.*@stable -> no matching package found. - Installation request for yiisoft/yii2 >=2.0.4 -> satisfiable by yiisoft/yii2[2.0.4, 2.0.5, 2.0.6]. Potential causes: - A typo in the package name - The package is not available in a stable-enough version according to your minimum-stability setting see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details. Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.> it doesn't work, when I use composer update:
Are you sure that the reason is
yii2-sharelinks-widget? When you remove it form composer.jsoncomposer updateworks fine ?Please create an issue on GitHub https://github.com/iJackUA/yii2-sharelinks-widget/issues if needed. It is much easier for me to track it there.
Leave a comment
If you have any questions, please ask in the forum instead.
Join the conversation to share a note.