Answer the question
In order to leave comments, you need to log in
Yii2 How to display an icon in a label?
It is necessary that in breadcrumbs, the link to the main page be an icon, encodeLabels set to false, but just my tag is displayed. Tell me what I'm doing wrong. Thanks in advance.
$this->params['breadcrumbs'][] = [
'template' => "<li>{link}</li>\n",
'label' => 'Objects',
'url' => ['/objects'],
'encodeLabels' => false
];
<?= Breadcrumbs::widget(['homeLink' => ['label' => "<i class=\"fa fa-home\" aria-hidden=\"true\"></i>"],'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [], ]); ?>
Answer the question
In order to leave comments, you need to log in
encodeLabels
<?= Breadcrumbs::widget([
'encodeLabels' => false,
Breadcrumbs::widget([
'homeLink' => [
'label' => "<i class=\"fa fa-home\" aria-hidden=\"true\"></i>"
'encode' => false,
'url' => Yii::$app->homeUrl
]
....
]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question