The preferred way to install this extension is through composer.
Either run
composer require "devmaks/yii2-glyphicons:~1.0"
or add
devmaks/yii2-glyphicons": "~1.0",
to the require
section of your composer.json
file.
use devmaks\yii\glyphicons`;
//normal use
echo GI::Icon('home'); //<span class="glyphicon glyphicon-home" aria-hidden="true"></span>
or
echo GI::Icon(GI::_HOME); //<span class="glyphicon glyphicon-home" aria-hidden="true"></span>
//shortcut
echo GI::I('apple'); //<span class="glyphicon glyphicon-apple" aria-hidden="true"></span>
or
echo GI::I(GI::_APPLE); //<span class="glyphicon glyphicon-apple" aria-hidden="true"></span>
//use additional options
echo GI::Icon(GI::_ARROW_UP,['data-role' => 'arrow','class'=>'additional-class']);
//icon in button
echo Html::button(Yii::t('app','{icon} Save', ['icon' => GI::Icon(GI::_SAVE)]));
or
echo Html::button(GI::Icon(GI::_SAVE). ' Save');
//<button type="button">
//<span class="glyphicon glyphicon-save" aria-hidden="true"></span> Save
//</button>
//short open tag
<?= GI::Icon(GI::_GLOBE) ?>
Comments