You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

57 lines
1.2 KiB

<?php
namespace common\modules\links;
use common\modules\links\widgets\MenuItemCreatorWidget;
use core\components\modules\ModuleInterface;
use yii\helpers\ArrayHelper;
/**
* blog module definition class
*/
class LinksModule extends \yii\base\Module implements ModuleInterface
{
/**
* @inheritdoc
*/
public $controllerNamespace = 'common\modules\links\controllers';
/**
* @inheritdoc
*/
public function init()
{
parent::init();
// custom initialization code goes here
}
public function bootstrap($app)
{
// add languages
$app->getI18n()->translations = ArrayHelper::merge($app->getI18n()->translations, [
'links' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@common/modules/links/messages',
],
'link_public' => [
'class' => 'yii\i18n\PhpMessageSource',
'basePath' => '@common/modules/links/messages',
],
]);
}
public static function getMenuItemCreator($menu_id): array
{
$widgets = [];
$widgets[] = [
'id' => 'links',
'title' => \Yii::t('links', 'Links'),
'content' => MenuItemCreatorWidget::widget([
'menu_id' => $menu_id,
]),
];
return $widgets;
}
}