Krajee
Thankful to Krajee! BUY A COFFEEor to get more out of us.
This is the first step to setting up the icon framework for your application. The Icon::map method allows you to initialize assets for a specific icon framework in your view. The parameters available for this method are:
  • view: The view object to initialize this framework. Usually you would set it to $this when calling within a view or view layout file.
  • framework: The icon-framework identifier to map to the view. You can use one of the Icon framework constants below:

    • Icon::BSG or "bsg" for Bootstrap Glyphicons
    • Icon::FA or "fa" for Font Awesome Icons
    • Icon::FAS or "fas" for Font Awesome 5.x Solid Icons
    • Icon::FAR or "far" for Font Awesome 5.x Regular Icons
    • Icon::FAB or "fab" for Font Awesome 5.x Brand Icons
    • Icon::FAL or "fal" for Font Awesome 5.x Light Icons (not available free)
    • Icon::UNI or "uni" for Krajee Uni Icons
    • Icon::EL or "el" for Elusive Icons
    • Icon::TYP or "typ" for Typicons
    • Icon::WHHG or "whhg" for Web Hosting Hub Glyphs
    • Icon::JUI or "jui" for JQuery UI Icons
    • Icon::SI or "si" for Socicon
    • Icon::OCT or "oct" for Github Octicons
    • Icon::FI or "fi" for Flag Icons
    • Icon::OI or "oi" for Open Iconic Icons

Tip

Not seeing the updated content on this page! Hard refresh your browser to clean cache for this page (e.g. SHIFT-F5 on Windows Chrome)

In order to setup an icon framework globally, you need to setup icon-framework as a param in your Yii Configuration file. This will have one of the values as determined by the Icon framework constants.
  • Icon::BSG or "bsg" for Bootstrap Glyphicons
  • Icon::FA or "fa" for Font Awesome Icons
  • Icon::FAS or "fas" for Font Awesome 5.x Solid Icons
  • Icon::FAR or "far" for Font Awesome 5.x Regular Icons
  • Icon::FAB or "fab" for Font Awesome 5.x Brand Icons
  • Icon::FAL or "fal" for Font Awesome 5.x Light Icons (not available free)
  • Icon::UNI or "uni" for Krajee Uni Icons
  • Icon::EL or "el" for Elusive Icons
  • Icon::TYP or "typ" for Typicons
  • Icon::WHHG or "whhg" for Web Hosting Hub Glyphs
  • Icon::JUI or "jui" for JQuery UI Icons
  • Icon::SI or "si" for Socicon
  • Icon::OCT or "oct" for Github Octicons
  • Icon::FI or "fi" for Flag Icons
  • Icon::OI or "oi" for Open Iconic Icons
An example of configuration file settings, and call in the view / layout file is described below.
// Yii Config File 
...
params => [
    'icon-framework' => 'el'  // set elusive icon font as default framework
];
...

// Call this in the view layout (typically at the head section)
use kartik\icons\Icon;
Icon::map($this);
You can also map different icon frameworks to different views. Or, you can use multiple icon frameworks in one single view. You need to pass the icon framework name as the second parameter to Icon::map in your view layout. This will have one of the values as determined by the Icon framework constants.
  • Icon::BSG or "bsg" for Bootstrap Glyphicons
  • Icon::FA or "fa" for Font Awesome Icons
  • Icon::FAS or "fas" for Font Awesome 5.x Solid Icons
  • Icon::FAR or "far" for Font Awesome 5.x Regular Icons
  • Icon::FAB or "fab" for Font Awesome 5.x Brand Icons
  • Icon::FAL or "fal" for Font Awesome 5.x Light Icons (not available free)
  • Icon::UNI or "uni" for Krajee Uni Icons
  • Icon::EL or "el" for Elusive Icons
  • Icon::TYP or "typ" for Typicons
  • Icon::WHHG or "whhg" for Web Hosting Hub Glyphs
  • Icon::JUI or "jui" for JQuery UI Icons
  • Icon::SI or "si" for Socicon
  • Icon::OCT or "oct" for Github Octicons
  • Icon::FI or "fi" for Flag Icons
  • Icon::OI or "oi" for Open Iconic Icons
An example of mapping icon frameworks specific to each view / layout file is described below. Call these in your view or layout files (typically at the head section)
// Call another framework even if Yii::$app->params['icon-framework'] is set to something else
use kartik\icons\Icon;
Icon::map($this, Icon::WHHG);

// Call multiple icon frameworks in one single view 
// Note: This may affect rendering performance depending on the size of the framework assets.
use kartik\icons\Icon;
Icon::map($this, Icon::EL);
Icon::map($this, Icon::TYP);

Note

You can now visit the Krajee Webtips Q & A forum for searching OR asking questions OR helping programmers with answers on these extensions and plugins. For asking a question click here. Select the appropriate question category (i.e. Krajee Plugins) and choose this current page plugin in the question related to field.

The comments and discussion section below are intended for generic discussions or feedback for this plugin. Developers may not be able to search or lookup here specific questions or tips on usage for this plugin.

 
visitors to Krajee Yii2 Demos since 22-May-2017