I am trying to setup a button with a link to a view. However yii\bootstrap\Button
does not have a property url
. I would rather use Yii as supposed to just use flat out php. The code as below would be the ideal situation, but since the url
option does not exist, is there an other way to fix this using Yii?
echo Button::Widget([
'label' => 'label',
'options' => ['class' => 'btn btn-primary'],
'url' => Url::toRoute(['/controller/action']),
]);
You could simply use Html::a() :
Or create your own version of
Button
class to handle this.PS: you don't need
Url::toRoute