What steps will reproduce the problem?
I'm trying to create a menu using Yiisoft\Yii\Widgets\Menu widget, but my goal is to use svg image as icon which requires a img tag instead of i tag. Which seems not possible because of i tag explicitly used in the Yiisoft\Yii\Widgets\Helper\Normalizer::menu().
I tried to create the img tag in a following way, but it didn't work as expected.
[
'label' => 'Dashboard',
'link' => administration_url('dashboard/index'),
'iconAttributes' => [
'tagName' => 'img',
'src' => 'icon-url',
'alt' => 'Dahsbaord'
]
]
Please note that the widgets I'm trying to use in a Yii2 application.
What is the expected result?
<img src="icon-url" alt="Dashbaord"/>
What do you get instead?
<i src="icon-url" alt="Dashbaord"></i>
Additional info
| Q |
A |
| Version |
^2.1 |
| PHP version |
8.3 |
| Operating system |
php:8.3-fpm-alpine |
What steps will reproduce the problem?
I'm trying to create a menu using
Yiisoft\Yii\Widgets\Menuwidget, but my goal is to use svg image as icon which requires aimgtag instead ofitag. Which seems not possible because ofitag explicitly used in theYiisoft\Yii\Widgets\Helper\Normalizer::menu().I tried to create the img tag in a following way, but it didn't work as expected.
[ 'label' => 'Dashboard', 'link' => administration_url('dashboard/index'), 'iconAttributes' => [ 'tagName' => 'img', 'src' => 'icon-url', 'alt' => 'Dahsbaord' ] ]Please note that the widgets I'm trying to use in a Yii2 application.
What is the expected result?
What do you get instead?
Additional info