Yii 1.1: efontawesome

Component to make FontAwesome available to Yii
22 followers

Just a small component I've made as an exercise and for fun which make available FontAwesome icons to Yii and don't collide with Bootstrap's Glyphicons.

Requirements

Created and Tested with Yii 1.1.12.

Usage

Extract the zip contents to a folder. Example: ext.EFontAwesome

Add the following code to config/main.php

...
        'preload' => array(
            ...
            'efontawesome',
            ...
        ),
...
 
        // application components
        'components' => array(
            'efontawesome' => array(
                'class' => 'ext.EFontAwesome.components.EFontAwesome',
            ),
        ),
...

How to use it:

Example taken from FontAwesome site:

icon-camera-retro

Note:

The classes defined by FontAwesome are like: "icon-xxx". To use it, you must reference the icons as "icon-fa-xxx"

Resources

Font Awesome Site

Total 15 comments

#15760 report it
Arno S at 2013/12/15 05:05am
Update FontAwesome version

For those who want a newer version of FontAwesome;

  • Install this extension.
  • Download the latest version at fontawesome.io
  • overwrite the fonts and the CSS from the FA zip in this extension
  • note that the FA CSS file refers to a '../fonts/' directory, whereas this extension puts them in the 'font' directory. Change either the path or the CSS.

And use the icons as described in the examples.

#13210 report it
migueArgentina at 2013/05/14 09:57pm
Working with YiiBootstrap

This is my code: I cannot make large icons work.

<?php $this->widget('bootstrap.widgets.TbMenu', array(
    'type'=>'list',
    'items'=>array(
        array('label'=>'Person 1', 'icon'=>'user'), // This is from YiiBootstrap
        array('label'=>'(+54 9) 343 4581266', 'icon'=>'icon-fa-large-phone'),
        ...
    ),
)); ?>

Thank you for your work!

#13140 report it
Jales Monteiro at 2013/05/07 02:21pm
one thing

first good work! second the light bulb doesn't appear. Are you using the third version? can you update it?

#12944 report it
Trejder at 2013/04/22 03:33pm
Bug in source code

You have a small bug in EFontAwesome.php. You're using

if(Yii::app() instanceof CConsoleApplication) return;

This is immediate function exit, so in case of console application, your component won't call parent::init();, which isn't the best idea, after all.

You may use for example:

if(!Yii::app() instanceof CConsoleApplication) Yii::app()->getClientScript()->registerCssFile($this->getAssetsUrl().'/css/font-awesome.css');
 
parent::init();

or anything similar.

#12865 report it
Subtronic at 2013/04/16 01:10pm
icon-fa-2x and etc

Hello, don't work resize classes, and classes like .icon-fa-2x don't determined in css file. mb i do something wrong?

#12507 report it
Sampa at 2013/03/25 02:29am
ofcourse...

Im stupid haha icon-fa-large etc works just fine:)

#12502 report it
Yerlt at 2013/03/24 02:36pm
@sampa

Try icon-fa-large, ... Works for me.

#12501 report it
Sampa at 2013/03/24 02:17pm
icon-large etc

Only the default size works for me, icon-fa-envelope for example but not icon-fa-envelope icon-large or icon-2x and so on. Would like those to.

#12207 report it
jmariani at 2013/03/06 10:21am
Font Awesome Update

Thank you very much. I'll update ASAP.

#12191 report it
Yerlt at 2013/03/05 05:29am
Font Awesome Update

Thanks for this awesome extension.

I just updated the assets so i can use the newest version of Font Awesome. There is nice new stuff with it. Maybe you should update the assets too :D

Greetings

#11223 report it
jmariani at 2012/12/28 02:06pm
Thank you FARAZFRANK!

For being a supporter!

#11219 report it
FARAZFRANK at 2012/12/28 07:14am
How to use it with booster-yii or yii-bootstrap extension?

Hi Guys,

Its very simple:

Instead of using class="icon-xxx"

You must use class="icon-fa-xxx"

By: EFontAwesome

#11085 report it
Jorge A. at 2012/12/15 01:11pm
Hi

Working very well

#11083 report it
jmariani at 2012/12/15 11:12am
Thanks

Please let me know if it works Ok.

#11076 report it
Jorge A. at 2012/12/14 10:49am
Excellent work!!!

Finally, many icons in bootstrap

Leave a comment

Please to leave your comment.

Create extension
  • Yii Version: 1.1
  • License: Other Open Source License
  • Developed by: jmariani
  • Category: User Interface
  • Votes: +19
  • Downloaded: 855 times
  • Created on: Dec 13, 2012
  • Last updated: Dec 15, 2012
  • Tags: font, icon, bootstrap