Inheritance: extends Core
示例#1
0
文件: menu.php 项目: skeeks-cms/cms
/**
 * Меню контента
 * @return array
 */
function dashboardsMenu()
{
    $result = [];
    if ($dashboards = \skeeks\cms\models\CmsDashboard::find()->orderBy("priority ASC")->all()) {
        /**
         * @var $dashboard \skeeks\cms\models\CmsDashboard
         */
        foreach ($dashboards as $dashboard) {
            $itemData = ['label' => $dashboard->name, "img" => ['\\skeeks\\cms\\modules\\admin\\assets\\AdminAsset', 'images/icons/dashboard.png'], 'url' => ["admin/index/dashboard", "pk" => $dashboard->id], "activeCallback" => function (\skeeks\cms\modules\admin\helpers\AdminMenuItem $adminMenuItem) {
                return (bool) (\Yii::$app->controller->action->uniqueId == 'admin/index/dashboard' && \yii\helpers\ArrayHelper::getValue($adminMenuItem->url, 'pk') == \Yii::$app->request->get('pk'));
            }];
            $result[] = $itemData;
        }
    } else {
        $result[] = ["label" => \Yii::t('skeeks/cms', "Рабочий стол 1"), "url" => ["admin/index"], "img" => ['\\skeeks\\cms\\modules\\admin\\assets\\AdminAsset', 'images/icons/dashboard.png']];
    }
    return $result;
}
示例#2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCmsDashboard()
 {
     return $this->hasOne(CmsDashboard::className(), ['id' => 'cms_dashboard_id']);
 }