yiisoft/yii2 — pull request #5792 by aleksanderd (2014-10-28 21:20:48+00:00)
Title: Added $url property to Button. Its allow to render <a href..> as buttons...

.... It is possible already but is not too usable in some cases. For example, if we need to render a buttongroup with href buttons and iconified labels(encodeLabels = false), we write something like this:

~~~
echo ButtonGroup::widget([
'buttons' => [
Button::widget([
'tagName' => 'a',
'encodeLabel' => false,
'label' => Icon::show('icon') . Yii::t('app', 'Index'),
'options' => [
'href' => Url::toRoute(['controller/index']),
],
]),
Button::widget([
'tagName' => 'a',
'encodeLabel' => false,
'label' => Icon::show('plus'),
'options' => [
'href' => Url::toRoute(['controller/create']),
],
]),
]
]);
~~~

Be noted, we cannot use button's configs since $tagName(needed to render 'a' tag) is not used in ButtonGroup::renderButtons... so we need to define 'encodeLabel' for each button.

With this patch we can write something like this:

~~~
echo ButtonGroup::widget([
'encodeLabels' => false,
'buttons' => [
[
'label' => Icon::show('icon') . Yii::t('app', 'Index'),
'url' => ['controller/index'],
],
[
'label' => Icon::show('plus'),
'url' => ['controller/create'],
],
]
]);
~~~