U
U
unknown2017-05-31 09:58:32
Yii
unknown, 2017-05-31 09:58:32

How to change breadcrumbs in Yii2?

Guys, please tell me how to add a class to a link in breadcrumbs?

<?= Breadcrumbs::widget([
        'options' => [
            'id' => 'bread',
            'class' => isset($viewBlock->viewBlockContent) ? 'has-border' : '',
        ],
        'homeLink' => [
            'label' => Yii::t('footer', 'home.link'),
            'url' => Url::to(['/']),
        ],
        'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
        'itemTemplate' => '<li>{link}</li>',
        'activeItemTemplate' => '<li><span>{link}</span></li>',
    ]); ?>

6cd6a0f2d6c4448ea2792cb64f854ac2.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Fedorov, 2017-05-31
@NikkyNick1

for example like this:

'homeLink' => [
    'label' => Yii::t('footer', 'home.link'),
    'url' => Url::to(['/']),
    'class' => 'myclass',
],

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question