Yii2 Icons Extension

This is a discussion forum for the yii2-icons extension. This extension offers an easy method to setup various icon frameworks to work with Yii Framework 2.0. Most popular and free icon frameworks available are currently supported. You can view demo and documentation of this extension here.

This is more a configuration at the Nav Widget level. Read the docs and code for Yii2 Bootstrap extension. The Yii2 Navbar uses Nav widget to generate menus. Note: The [font="Lucida Console"]kartik\icons\Icon::show[/font] will generate HTML code. So in your [font="Lucida Console"]Nav::widget[/font] you should use [font="Lucida Console"]encodeLabels => false[/font] to not Html encode icons in labels. For example:




use kartik\icons\Icon;


$items = [

	['label' => Icon::show('home') . 'Home', 'url' => ['/site/index']],

];


NavBar::begin(['brandLabel' => 'My Application']);


/* Note you must encodeLabels to false to display icons in labels */

echo \yii\bootstrap\Nav::widget([

	'items' => $items,

	'encodeLabels' => false

]);


NavBar::end();



Thnx, works great. Also thank you for sharing the Yii2 tools, great!

I’m getting started with Yii2 and cannot install your extension through Composer. It complains that the extension requires yiisoft/yii2:“dev-master” which isn’t found. I installed the Yii2 basic application with no problems and it uses yiisoft/yii2:"*", not dev-master. Please let me know how to proceed.

Thanks,

Not sure what you have missed. Cannot replicate at my end. I tested a fresh install of the basic app and then installed this extension and it works. After basic app install, I added [font="Courier New"]kartik-v/yii2-icons: dev-master[/font] to the require section of composer.json, and ran [font="Courier New"]composer update[/font] and the extension installs flawlessly. Can you check the composer settings, package cache, and see if something is amiss?

Thanks for the prompt answer; I’ll try again and report back the results.

Edit – Tried again and it worked! I don’t know what happened before… Thanks!

No problems - it happens at times… :). Nice to know you got it working.

Extension upgraded to include 2 new frameworks:

[list=1]

[*]Krajee’s Uni Icons - Unicode Symbols made available as CSS. Refer demo here

[*]Bootstrap Glyphicons added to the list of frameworks.

[/list]

Check the updated extension demo.

Thanks this was really useful for my app.