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.

60 lines
1.2 KiB

<?php
namespace common\modules\links;
use common\modules\links\widgets\MenuItemCreatorWidget;
use core\components\modules\ModuleInterface;
3 years ago
use Yii;
use yii\base\Module;
use yii\helpers\ArrayHelper;
3 years ago
use yii\web\Application;
/**
* blog module definition class
*/
3 years ago
class LinksModule extends Module implements ModuleInterface
{
/**
* @inheritdoc
*/
public $controllerNamespace = 'common\modules\links\controllers';
/**
* @inheritdoc
*/
public function init()
{
parent::init();
// custom initialization code goes here
}
3 years ago
public function bootstrap(Application $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',
3 years ago
'title' => Yii::t('links', 'Links'),
'content' => MenuItemCreatorWidget::widget([
'menu_id' => $menu_id,
]),
];
return $widgets;
}
}