项目作者: Cenotia

项目描述 :
Wrapper to bootstrap-iconpicker with added fontawesome helpers for size, orientation and color.
高级语言: PHP
项目地址: git://github.com/Cenotia/yii2-fa-icon-selector.git
创建时间: 2017-01-02T13:27:23Z
项目社区:https://github.com/Cenotia/yii2-fa-icon-selector

开源协议:MIT License

下载


YII2 Fa Icon Selector

yii2-fa-icon-selector

This widget can be attached to a model attribute in order to associate a FontAwesome icon to it with optional orientation, size and color.

#

Prerequisite

This widget is a wrapper for Bootstrap IconPicker and concentrates only on the FontAwesome part and some of its helpers Font Awesome.

Installation

The preferred way to install FaiconSelector is through Composer. Either add the following to the require section of your composer.json file:

"cenotia/yii2-fa-icon-selector": "dev-master"

Or run:

$ php composer.phar require cenotia/yii2-fa-icon-selector "dev-master"

You can manually install FaiconSelector by downloading the source in ZIP-format.

Using FaiconSelector

FaiconSelector is a Yii 2.0 InputWidget. Like any other InputWidget it can be associated with a model and an attribute (or with a name and a value).

FaiconSelector is in namespace cenotia\components\faiconSelector.

For instance, to associate faiconSelector with the attribute 'cat_icon' in a form view, use code like this:

  1. use cenotia\components\faiconSelector\FaiconSelector;
  2. ...
  3. <?php echo $form->field($model, 'cat_icon')->widget(FaiconSelector::className()) ?>
  4. ...
  5. //The class string is what will be stored. Example: fa fa-bank fa-2x
  6. //So your field should be a varchar of 100 at least.
  7. //So you will just to display like this for example.
  8. ...
  9. <i class="<?= $model->cat_icon ?>"></i>
  10. ...

options

De facto, InputWidget properties can also be used.

More options to be documented in coming versions.