For example, breadcrumbs like "Home / Sample Post / Edit" means the user is viewing an edit page
for the "Sample Post". He can click on "Sample Post" to view that page, or he can click on "Home"
to return to the homepage.
To use Breadcrumbs, you need to configure its [[links]] property, which specifies the links to be displayed. For example,
php
$this is the view object currently being used
echo Breadcrumbs::widget([
'itemTemplate' => "{link} \n", // template for all links
'links' => [
[
'label' => 'Post Category',
'url' => ['post-category/view', 'id' => 10],
'template' => "{link} \n", // template for this link only
],
['label' => 'Sample Post', 'url' => ['post/edit', 'id' => 1]],
'Edit',
],
]);
Because breadcrumbs usually appears in nearly every page of a website, you may consider placing it in a layout view.
You can use a view parameter (e.g. $this->params['breadcrumbs']) to configure the links in different
views. In the layout view, you assign this view parameter to the [[links]] property like the following:
php
$this is the view object currently being used
echo Breadcrumbs::widget([
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]);