PHP code example of yii2-tools / yii2-breadcrumbs-filter
1. Go to this page and download the library: Download yii2-tools/yii2-breadcrumbs-filter library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
yii2-tools / yii2-breadcrumbs-filter example snippets
public function behaviors()
{
return array_merge(parent::behaviors(), [
'breadcrumbs' => [
'class' => \yii\tools\filters\BreadcrumbsFilter::className(),
]
]);
}
use yii\base\Module as BaseModule;
use yii\tools\filters\BreadcrumbsFilter;
class Module extends BaseModule
{
/**
* Module name
* @var string
*/
public $name = 'My Module';
/**
* Enable/Disable breadcrumbs natigation via app\components\filters\BreadcrumbsFilter
* For module and submodules, without affects on parent module
* @var bool
*/
public $breadcrumbs = true;
/**
* Array of [routes|controllers|actions] names which shouldn't have breadcrumbs
* ['*'] means what breadcrumbs navigation disabled for all controllers and actions (direct childs)
* For module and submodules, without affects on parent module
* @var bool
*/
public $breadcrumbsExceptRoutes = [];
/**
* @inheritdoc
*/
public function behaviors()
{
$behaviors = [];
if ($this->breadcrumbs) {
$behaviors['breadcrumbs'] = [
'class' => BreadcrumbsFilter::className(),
'label' => $this->name,
'defaultRoute' => $this->defaultRoute,
'exceptRoutes' => $this->breadcrumbsExceptRoutes,
];
}
return array_merge(parent::behaviors(), $behaviors);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.