2017 © Pedro Peláez
 

yii2-extension yii2-icofont

Asset Bundle for Yii2 with IcoFont http://icofont.com

image

loveorigami/yii2-icofont

Asset Bundle for Yii2 with IcoFont http://icofont.com

  • CSS
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 0 Open issues
  • 4 Versions
  • 63 % Grown

The README.md

Yii 2 IcoFont Asset Bundle

Latest Stable Version Total Downloads License, (*1)

This extension provides a assets bundle with IcoFont for Yii framework 2.0 applications and helper to use icons., (*2)

Installation

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

Either run, (*4)

composer require "loveorigami/yii2-icofont:*"

or add, (*5)

"loveorigami/yii2-icofont": "*",

to the require section of your composer.json file., (*6)

Usage

In view, (*7)

lo\icofont\IcoFontAsset::register($this);

or as dependency in your main application asset bundle, (*8)

class AppAsset extends AssetBundle
{
    // ...

    public $depends = [
        // ...
        'lo\icofont\IcoFontAsset'
    ];
}

IcoFont (FI) helper examples

use lo\icofont\FI;

// normal use
echo FI::icon('home'); // <i class="icofont icofont-home"></i>

// shortcut
echo FI::i('home'); // <i class="icofont icofont-home"></i>

// icon with additional attributes
echo FI::icon(
    'arrow-left', 
    ['class' => 'big', 'data-role' => 'arrow']
); // <i class="big icofont icofont-arrow-left" data-role="arrow"></i>

// icon in button
echo Html::submitButton(
    Yii::t('app', '{icon} Save', ['icon' => FI::icon('check')])
); // <button type="submit"><i class="icofont icofont-check"></i> Save</button>

// icon with additional methods
echo FI::icon('arrow-right')->inverse();    // <i class="icofont icofont-arrow-right icofont-inverse"></i>
echo FI::icon('spinner')->spin();           // <i class="icofont icofont-spinner icofont-spin"></i>
echo FI::icon('home')->fixedWidth();        // <i class="icofont icofont-home icofont-fw"></i>
echo FI::icon('home')->li();                // <i class="icofont icofont-home icofont-li"></i>
echo FI::icon('home')->border();            // <i class="icofont icofont-home icofont-border"></i>
echo FI::icon('arrow-right')->pullLeft();   // <i class="icofont icofont-arrow-right icofont-pull-left"></i>
echo FI::icon('arrow-right')->pullRight();  // <i class="icofont icofont-arrow-right icofont-pull-right"></i>

// icon size
echo FI::icon('adjust')->size(FI::SIZE_3X);
// values: FI::SIZE_LARGE, FI::SIZE_2X, FI::SIZE_3X, FI::SIZE_4X, FI::SIZE_5X
// <i class="icofont icofont-adjust icofont-size-3x"></i>

// icon rotate
echo FI::icon('adjust')->rotate(FI::ROTATE_90); 
// values: FI::ROTATE_90, FI::ROTATE_180, FI::ROTATE_180
// <i class="icofont icofont-adjust icofont-rotate-90"></i>

// icon flip
echo FI::icon('adjust')->flip(FI::FLIP_VERTICAL); 
// values: FI::FLIP_HORIZONTAL, FI::FLIP_VERTICAL
// <i class="icofont icofont-adjust icofont-flip-vertical"></i>

// icon with multiple methods
echo FI::icon('home')
        ->spin()
        ->fixedWidth()
        ->pullLeft()
        ->size(FI::SIZE_LARGE);
// <i class="icofont icofont-home icofont-spin icofont-fw icofont-pull-left icofont-size-lg"></i>

// icons stack
echo FI::stack()
        ->on('square')
        ->icon('shield');
// <span class="icofont-stack">
//   <i class="icofont icofont-shield icofont-stack-2x"></i>
//   <i class="icofont icofont-square icofont-stack-1x"></i>
// </span>

// icons stack with additional attributes
echo FI::stack(['data-role' => 'stacked-icon'])
     ->on(FI::icon('square')->inverse())
     ->icon(FI::icon('shield')->spin());
// <span class="icofont-stack" data-role="stacked-icon">
//   <i class="icofont icofont-square-o icofont-inverse icofont-stack-2x"></i>
//   <i class="icofont icofont-shield icofont-spin icofont-stack-1x"></i>
// </span>

// unordered list icons 
echo FI::ul(['data-role' => 'unordered-list'])
    ->item('spinner', 'Bullet item')
    ->item('check', 'Checked item');
// 

<

ul class="icofont-ul" data-role="unordered-list">
//   <li><i class="icofont icofont-spinner icofont-li"></i>Bullet item</li>
//   <li><i class="icofont icofont-check icofont-li"></i>Checked Item</li>
// </span>

// autocomplete icons name in IDE
echo FI::icon(FI::_MAGIC);
echo FI::icon(FI::_ARROW_RIGHT);
echo FI::stack()
     ->on(FI::_SQUARE)
     ->icon(FI::_SHIELD);

See also

License

loveorigami/yii2-icofont is released under the MIT License. See the bundled LICENSE.md for details., (*9)

The Versions

01/03 2018

dev-master

9999999-dev

Asset Bundle for Yii2 with IcoFont http://icofont.com

  Sources   Download

MIT

The Requires

 

yii2 font icons icofont

02/09 2016

1.3

1.3.0.0

Asset Bundle for Yii2 with IcoFont http://icofont.com

  Sources   Download

MIT

The Requires

 

yii2 font icons icofont

30/08 2016

1.1

1.1.0.0

Asset Bundle for Yii2 with IcoFont http://icofont.com

  Sources   Download

MIT

The Requires

 

yii2 icofont

30/08 2016

1.0

1.0.0.0

Yii2 icofont

  Sources   Download

GPL-3.0+

The Requires

 

yii2 icofont