yiisoft/yii2 — pull request #5208 by nkovacs (2014-09-27 15:03:02+00:00)
Title: Add icons support to bootstrap widgets.

see #5207

* Button, ButtonDropdown have `icon` property
* ButtonGroup supports `icon` element in the `buttons` property
* Button and ButtonDropdown `label` defaults to empty string (more convenient for making icon-only buttons)
* Collapse has `encodeLabels` property and encodes headers (array keys in `items`) by default, for consistency and safety.
* item can also have `encode` element for consistency
* the api is not fully consistent (use of array keys instead of `label` element like in Tabs)
* also, with both Tabs and Collapse, it's not obvious whether `encode` refers to the label or the content
* Collapse item can have `icon` element, which is applied to header
* Dropdown, Nav and Tabs item can have `icon` element (applied to tab header in Tabs)
* The `label` option is not required if `icon` is specified.
* `icon` should be a full html tag, not an icon name like in yiistrap, to make it possible to use any other icon plugin, e.g. font awesome.
* Icon class added to make rendering icons more convenient and similar to yiistrap in Yii 1.
* extends from \yii\base\Widget instead of yii\bootstrap\Widget because the latter adds an id attribute
* You can extend it if you want to use another icon plugin, or just use plain html.
* You can even use your class to map from glyphicons to the other plugin, so you only need to change one `use` statement in the view to change your icons.
* static method `icon` is less verbose than `widget`, but still stuttery. `Icon::widget(['icon' => 'user'])` vs `Icon::icon('user')`. I could change it to `Glyph::icon('user')`, and then you could have `Fa::icon('user')` for font awesome etc.