rmrevin/yii2-socicon

Asset Bundle for Yii2 with Socicon

Installs: 278

Dependents: 2

Suggesters: 0

Security: 0

Stars: 6

Watchers: 2

Forks: 2

Open Issues: 1

Type:yii2-extension

1.1.0 2016-05-20 18:20 UTC

This package is not auto-updated.

Last update: 2024-11-20 16:09:39 UTC


README

License Latest Stable Version Latest Unstable Version Total Downloads

Code Status

Scrutinizer Code Quality Code Coverage Travis CI Build Status Dependency Status

Installation

Add in composer.json:

{
    "require": {
        "rmrevin/yii2-socicon": "~1.1"
    }
}

Usage

In view

<?
// ...

rmrevin\yii\socicon\AssetBundle::register($this);

or as dependency in your asset bundle

<?
// ...

class AppAsset extends AssetBundle
{
	// ...

	public $depends = [
		// ...
		'\rmrevin\yii\socicon\AssetBundle'
	];
}

Helper

use rmrevin\yii\socicon\SI;

echo SI::icon('twitter');
// <i class="socicon socicon-twitter"></i>
echo SI::icon('twitter', ['class' => 'big', 'data-role' => 'social-button']);
// <i class="big socicon socicon-twitter" data-role="social-button"></i>
echo Html::submitButton(Yii::t('app', '{check} Tweet', ['check' => SI::icon('twitter')]));
// <button type="submit"><i class="socicon socicon-twitter"></i> Tweet</button>

// autocomplete in IDE
echo SI::icon(SI::_TWITTER);
echo SI::icon(SI::_DISQUS);

Another prefix

SI::$cssPrefix = 'si';

echo SI::icon('twitter');
// <i class="si si-twitter"></i>