Yii2 AdminLte Iframe Mode
for V2.0
。 Not compatible for before !!
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.
<?php
use kriss\iframeLayout\component\IframeMode;
return [
'components' => [
IframeMode::COMPONENT_NAME => [
'class' => IframeMode::class,
'enable' => true,
'defaultSwitch' => true,
],
]
];
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
(main.php)
中增加 Asset
<?php
\kriss\iframeLayout\widget\IframeModeAssetWidget::widget();
在上面的操作基础上
在某个控制器,比如 SiteController
中增加 action
<?php
use kriss\iframeLayout\action\IframeModeSwitchAction;
public function actions()
{
return [
// 其他 actions
'iframe-mode-switch' => [
'class' => IframeModeSwitchAction::className(),
]
];
}
<?= \kriss\iframeLayout\widget\IframeModeSwitchWidget::widget() ?>
Comments