This extension is an the Page hint and redirect of The widget
NOTE: This extension dependent on the yiisoft/yii2. Check This extension the bundled
composer.json
requirements and dependencies. At the same time, This extension has been encapsulated in reparsoft/Yii2-Widgets extension. Unified call namespacerepkit\widgets
. If the user choose custom installation other extensions, at use of time,namespace
Please refer API Documentation oforigin namespace
description.
The preferred way to install this extension is through composer. Remember to refer to the bundled composer.json
for this extension's requirements and dependencies.
Either run
$ php composer.phar require reparsoft/yii2-widgets-redirect "*"
or add
"reparsoft/yii2-widgets-redirect": "*"
to the require
section of your composer.json
file.
##Usage
Once the extension is installed, simply modify your application configuration as follows:
return[
'components' => [
'redirect' => '\repkit\widgets\RedirectUrl'
]
]
or
return[
'components' => [
'redirectUrl' => [
'class' => '\repkit\widgets\RedirectUrl',
......
]
]
]
Add route record behavior to controller (added this config later, you can used back previous page of Operation):
public function behaviors()
{
return [
'recordUrl' => [
'class' => \repkit\url\behaviors\RecordUrlBehavior::className()
],
];
}
Settings options can at set in Configuration file
wait:
[integer] wait time
- defaultValue: 5 (Unit: second)
layout:
[string] The page layout file
- defaultValue: "@repkit/url/views/layouts/redirect.php"
render:
[string] render view file
- defaultValue: "@repkit/url/views/redirect/redirect"
return[
'components' => [
'redUrl' => [
'class' => '\repkit\widgets\RedirectUrl',
'wait' => 3,
'layout' => ...,
'render' => ...
]
]
]
- REDIRECT_BACK: "BACK"
- REDIRECT_HOME: "HOME"
jump
: Display hint messages and redirect target url
-
params:
- $url: [string] target url
- $msg: [string] hint message
- $wait: [integer|empty] wait time. (default: null)
-
return: [string]
public function jump($url, $msg, $wait=null){ ... }
####Example:
public function actionIndex(){
return \Yii::$app->redirectUrl->jump('BACK', 'back previous page', 20);
}
public function actionIndex(){
return \Yii::$app->redirectUrl->jump(Url::to(['login']), 'sorry! please login first');
}
- API Documentation github repository: Yii2-Toolkit-Doc Github Repository.
- Online API Documentation: Yii2-Toolkit API Documentation
This extension is released under the BSD-3-Clause License. See the bundled LICENSE.md
for details.