set(Breadcrumbs::class, function ($container, $params, $args) {
return new Breadcrumbs(ArrayHelper::merge([
'homeLink' => [
//'label' => '',
'label' => \Yii::t('post', 'Home'),
'encode' => false,
'url' => \Yii::$app->homeUrl,
],
], $args));
});
// Load settings
$settings = Settings::find()->with('translations')->andWhere(['active' => 1])->all();
$settings_array = $settings ? ArrayHelper::map($settings, 'key', function ($el) {
return isset($el->translation->value) ? $el->translation->value : '';
}, 'section') : [];
$app->params['settings'] = $settings_array;
// Add finish UrlRules
$app->getUrlManager()->addRules([
'<_c:[\w\-]+>' => '<_c>/index',
'<_c:[\w\-]+>/' => '<_c>/view',
'<_c:[\w\-]+>/<_a:[\w-]+>' => '<_c>/<_a>',
'<_c:[\w\-]+>//<_a:[\w\-]+>' => '<_c>/<_a>',
]);
// redefine home url
\Yii::$app->homeUrl = LanguageHelper::addLangToUrl(\Yii::$app->homeUrl);
}
}