Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove 'home' link from breadcrumb

I have breadcrumbs such as Home > Instance > Action in all my view pages. How can I remove the 'Home' link from all the breadcrumbs?

$this->breadcrumbs=array(
'Keypairs'=>array('admin'),
'Manage',
);
like image 657
Soojoo Avatar asked Apr 01 '13 11:04

Soojoo


2 Answers

This can be done by setting the homeLink property to false, in your CBreadcrumbs widget initialization. This is usually done in a layout file.

In the default Yii app, in protected/views/layouts/main.php:

<?php if(isset($this->breadcrumbs)):?>
    <?php $this->widget('zii.widgets.CBreadcrumbs', array(
        'links'=>$this->breadcrumbs,
        'homeLink'=>false // add this line
    )); ?><!-- breadcrumbs -->
<?php endif?>
like image 126
bool.dev Avatar answered Sep 19 '22 22:09

bool.dev


in layouts/main.php add 'homeLink' => false

<?= Breadcrumbs::widget([
     'links' => isset($this->params['breadcrumbs'])? $this->params['breadcrumbs'] : [],
     'homeLink' => false
]) ?>
like image 23
Rajani Avatar answered Sep 21 '22 22:09

Rajani