2017 © Pedro Peláez
 

yii2-extension yii2-sharelinks

Yii2 widget for social networks or email sharing

image

webulla/yii2-sharelinks

Yii2 widget for social networks or email sharing

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 1 Open issues
  • 1 Versions
  • 1 % Grown

The README.md

Webulla Yii2 sharing links widget

Widget for posting links to publications on social networks., (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

$ composer require "webulla/yii2-sharelinks":"*"

Usage

First, you need to connect the widget:, (*4)

use webulla\sharelinks\ShareLinks;

Then, you can use widget with default configurations for sharing via facebook, twitter, vkontakte and email:, (*5)

echo ShareLinks::widget([
    'links' => [
        'facebook' => [],
        'twitter' => [],
        'vkontakte' => [],
        'email' => [],
    ]
]);

Or, you can override any default settings:, (*6)

echo ShareLinks::widget([
    // page url (default: Yii::$app->request->absoluteUrl)
    'url' => 'http://yoursite.com/page',

    // page title (default: Yii::$app->view->title)
    'title' => 'Page title',

    // page description
    'body' => 'Page description',

    // links collection
    'links' => [
        // default service
        'facebook' => ['label' => 'Facebook'],

        // custom service in popup window
        'service' => ['label' => 'Share via Service',
            'url' => 'http://service.com/share?title={title}&body={body}&url={url}'
        ],

        // custom service in new tab
        'service-manual' => ['label' => 'Share via Service',
            'url' => 'http://service.com/share?title={title}&body={body}&url={url}',
            'options' => [
                'class' => 'share-link-manual',  // disable on click event listening
                'target' => '_blank', // open link in new tab
            ]
        ],
    ]
]);

Predefined services:, (*7)

$services = [
    'twitter' => ['label' => 'Share via twitter'],
    'facebook' => ['label' => 'Share via Facebook'],
    'vkontakte' => ['label' => 'Share via Vkontakte'],
    'gplus' => ['label' => 'Share via Google Plus'],
    'linkedin' => ['label' => 'Share via Linkedin'],
    'kindle' => ['label' => 'Share via Kindle'],
    'email' => ['label' => 'Share via E-mail'],
];

The Versions

19/04 2015

dev-master

9999999-dev https://github.com/gustarus/yii2-share_links

Yii2 widget for social networks or email sharing

  Sources   Download

MIT

The Requires

 

social extension yii2 yii widget share network webulla