mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-16 15:21:13 +08:00
Merge branch 'pjax' of https://github.com/Alex-Code/yii2 into Alex-Code-pjax
This commit is contained in:
@ -43,10 +43,11 @@ Yii Framework 2 Change Log
|
|||||||
- Bug #10302: Fixed JS function `yii.getQueryParams`, which parsed array variables incorrectly (servocoder, silverfire)
|
- Bug #10302: Fixed JS function `yii.getQueryParams`, which parsed array variables incorrectly (servocoder, silverfire)
|
||||||
- Bug: Fixed generation of canonical URLs for `ViewAction` pages (samdark)
|
- Bug: Fixed generation of canonical URLs for `ViewAction` pages (samdark)
|
||||||
- Bug: Fixed `mb_*` functions calls to use `UTF-8` or `Yii::$app->charset` (silverfire)
|
- Bug: Fixed `mb_*` functions calls to use `UTF-8` or `Yii::$app->charset` (silverfire)
|
||||||
- Enh #3506: Added `\yii\validators\IpValidator` to perform validation of IP addresses and subnets (SilverFire, samdark)
|
- Enh #3506: Added `yii\validators\IpValidator` to perform validation of IP addresses and subnets (SilverFire, samdark)
|
||||||
- Enh #5146: Added `\yii\i18n\Formatter::asDuration()` method (nineinchnick, SilverFire)
|
- Enh #4104: Added `yii\filters\auth\AuthMethod::optional` for optional authentification in all child classes (SilverFire)
|
||||||
|
- Enh #5146: Added `yii\i18n\Formatter::asDuration()` method (nineinchnick, SilverFire)
|
||||||
|
- Enh #5902: `yii\widgets\Pjax::options` now support special option `tag` to specify tag of container (Alex-Code)
|
||||||
- Enh #7341: Client validation now skips disabled inputs (SamMousa)
|
- Enh #7341: Client validation now skips disabled inputs (SamMousa)
|
||||||
- Enh #4104: Added `yii\filters\auth\AuthMetod::optional` for optional authentification in all child classes (SilverFire)
|
|
||||||
- Enh #7566: Improved `\yii\validators\CompareValidator` default messages (slinstj)
|
- Enh #7566: Improved `\yii\validators\CompareValidator` default messages (slinstj)
|
||||||
- Enh #7581: Added ability to specify range using anonymous function in `RangeValidator` (RomeroMsk)
|
- Enh #7581: Added ability to specify range using anonymous function in `RangeValidator` (RomeroMsk)
|
||||||
- Enh #8284: Added `\yii\captcha\CaptchaAction::$imageLibrary` property allowing to set image rendering library (AnatolyRugalev)
|
- Enh #8284: Added `\yii\captcha\CaptchaAction::$imageLibrary` property allowing to set image rendering library (AnatolyRugalev)
|
||||||
|
@ -9,6 +9,7 @@ namespace yii\widgets;
|
|||||||
|
|
||||||
use Yii;
|
use Yii;
|
||||||
use yii\base\Widget;
|
use yii\base\Widget;
|
||||||
|
use yii\helpers\ArrayHelper;
|
||||||
use yii\helpers\Html;
|
use yii\helpers\Html;
|
||||||
use yii\helpers\Json;
|
use yii\helpers\Json;
|
||||||
use yii\web\Response;
|
use yii\web\Response;
|
||||||
@ -44,7 +45,10 @@ use yii\web\Response;
|
|||||||
class Pjax extends Widget
|
class Pjax extends Widget
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @var array the HTML attributes for the widget container tag.
|
* @var array the HTML attributes for the widget container tag. The following special options are recognized:
|
||||||
|
*
|
||||||
|
* - `tag`: string, the tag name for the container. Defaults to `div`
|
||||||
|
*
|
||||||
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
|
* @see \yii\helpers\Html::renderTagAttributes() for details on how attributes are being rendered.
|
||||||
*/
|
*/
|
||||||
public $options = [];
|
public $options = [];
|
||||||
@ -87,7 +91,6 @@ class Pjax extends Widget
|
|||||||
*/
|
*/
|
||||||
public $clientOptions;
|
public $clientOptions;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
@ -109,13 +112,15 @@ class Pjax extends Widget
|
|||||||
echo Html::tag('title', Html::encode($view->title));
|
echo Html::tag('title', Html::encode($view->title));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
echo Html::beginTag('div', array_merge([
|
$options = $this->options;
|
||||||
|
$tag = ArrayHelper::remove($options, 'tag', 'div');
|
||||||
|
echo Html::beginTag($tag, array_merge([
|
||||||
'data-pjax-container' => '',
|
'data-pjax-container' => '',
|
||||||
'data-pjax-push-state' => $this->enablePushState,
|
'data-pjax-push-state' => $this->enablePushState,
|
||||||
'data-pjax-replace-state' => $this->enableReplaceState,
|
'data-pjax-replace-state' => $this->enableReplaceState,
|
||||||
'data-pjax-timeout' => $this->timeout,
|
'data-pjax-timeout' => $this->timeout,
|
||||||
'data-pjax-scrollto' => $this->scrollTo,
|
'data-pjax-scrollto' => $this->scrollTo,
|
||||||
], $this->options));
|
], $options));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -125,7 +130,7 @@ class Pjax extends Widget
|
|||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
if (!$this->requiresPjax()) {
|
if (!$this->requiresPjax()) {
|
||||||
echo Html::endTag('div');
|
echo Html::endTag(ArrayHelper::remove($this->options, 'tag', 'div'));
|
||||||
$this->registerClientScript();
|
$this->registerClientScript();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user