daxslab/yii2-sharelinks-widget Yii2 widget for popular social networks 'share link' generation

yii2-sharelinks-widget

  1. Supported Social Networks
  2. Installation via Composer
  3. Usage Example
  4. Example custom view file

Yii2 widget for popular social networks "share link" generation. Based on https://github.com/ijackua/yii2-sharelinks-widget.

Supported Social Networks

Installation via Composer

add to require section of your composer.json "daxslab/yii2-sharelinks-widget": "*" and run composer update

Usage Example

in template file use ~~~php <?php echo \daxslab\sharelinks\ShareLinks::widget(

[
	'viewName' => '@app/views/mypath/shareLinks.php'   //custom view file for you links appearance
]

); ?> ~~~

Example custom view file

This eaxmple uses custom icons from Fontello, but you can make it what ever you want and customize what links do you need and what not. Your @app/views/mypath/shareLinks.php file could look like ~~~php <?php use daxslab\sharelinks\ShareLinks; use \yii\helpers\Html;

/**

  • @var yii\base\View $this */

?>

<?= Html::a('', $this->context->shareUrl(ShareLinks::SOCIAL_FACEBOOK), ['title' => 'Share to Facebook']) ?> <?= Html::a('', $this->context->shareUrl(ShareLinks::SOCIAL_TWITTER), ['title' => 'Share to Twitter']) ?> <?= Html::a('', $this->context->shareUrl(ShareLinks::SOCIAL_LINKEDIN), ['title' => 'Share to LinkedIn']) ?> <?= Html::a('', $this->context->shareUrl(ShareLinks::SOCIAL_GPLUS), ['title' => 'Share to Google Plus']) ?> <?= Html::a('', $this->context->shareUrl(ShareLinks::SOCIAL_VKONTAKTE), ['title' => 'Share to Vkontakte']) ?> <?= Html::a('', $this->context->shareUrl(ShareLinks::SOCIAL_KINDLE), ['title' => 'Send to Kindle']) ?>

0 0
1 follower
59 downloads
Yii Version: 2.0
License: MIT
Category: User Interface
Created on: Aug 28, 2020
Last updated: (not set)
Packagist Profile
Github Repository

Related Extensions