kriss/yii2-adminlte-iframe-mode

Yii2 AdminLte Iframe Mode

v2.0.1 2018-09-10 02:30 UTC

This package is auto-updated.

Last update: 2024-11-10 15:08:45 UTC


README

Yii2 AdminLte Iframe Mode

Important

for V2.0。 Not compatible for before !!

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require kriss/yii2-adminlte-iframe-mode -vvv

or add

"kriss/yii2-adminlte-iframe-mode": "^2.0"

to the require section of your composer.json file.

预览

Effect picture 1

全局全部开启标签页模式

  1. 增加配置
<?php
use kriss\iframeLayout\component\IframeMode;

return [
    'components' => [
        IframeMode::COMPONENT_NAME => [
            'class' => IframeMode::class,
            'enable' => true,
            'defaultSwitch' => true,
        ],
    ]
];
  1. 在基础控制器中增加 behavior
<?php
use kriss\iframeLayout\filter\IframeLinkFilter;

public function behaviors()
{
    $behaviors = parent::behaviors();

    $behaviors['iframe_layout'] = [
        'class' => IframeLinkFilter::className(),
        //'layout' => '@app/views/layouts/main-content', // 使用该参数自定义布局
    ];

    return $behaviors;
}

布局参考: /views/main-content.php

  1. 在默认的布局文件 (main.php) 中增加 Asset
<?php
\kriss\iframeLayout\widget\IframeModeAssetWidget::widget();

用户动态可更改模式

  1. 在上面的操作基础上

  2. 在某个控制器,比如 SiteController 中增加 action

<?php
use kriss\iframeLayout\action\IframeModeSwitchAction;

public function actions()
{
    return [
        // 其他 actions
        'iframe-mode-switch' => [
            'class' => IframeModeSwitchAction::className(),
        ]
    ];
}
  1. 增加切换模式的链接按钮
<?= \kriss\iframeLayout\widget\IframeModeSwitchWidget::widget() ?>