本文整理汇总了PHP中yii\helpers\ArrayHelper::getvalue方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayHelper::getvalue方法的具体用法?PHP ArrayHelper::getvalue怎么用?PHP ArrayHelper::getvalue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\helpers\ArrayHelper
的用法示例。
在下文中一共展示了ArrayHelper::getvalue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: beginPjax
/**
* Begins the PJAX container
*/
protected function beginPjax()
{
if (!$this->pjax) {
return;
}
$view = $this->getView();
if (empty($this->pjaxSettings['options']['id'])) {
$this->pjaxSettings['options']['id'] = $this->options['id'] . '-pjax';
}
$container = 'jQuery("#' . $this->pjaxSettings['options']['id'] . '")';
$js = $container;
if (ArrayHelper::getvalue($this->pjaxSettings, 'neverTimeout', true)) {
$js .= ".on('pjax:timeout', function(e){e.preventDefault()})";
}
$loadingCss = ArrayHelper::getvalue($this->pjaxSettings, 'loadingCssClass', 'kv-grid-loading');
$postPjaxJs = "setTimeout({$this->_gridClientFunc}, 2500);";
if ($loadingCss !== false) {
$grid = 'jQuery("#' . $this->containerOptions['id'] . '")';
if ($loadingCss === true) {
$loadingCss = 'kv-grid-loading';
}
$js .= ".on('pjax:send', function(){{$grid}.addClass('{$loadingCss}')})";
$postPjaxJs .= "{$grid}.removeClass('{$loadingCss}');";
}
if (!empty($postPjaxJs)) {
$event = 'pjax:complete.' . hash('crc32', $postPjaxJs);
$js .= ".off('{$event}').on('{$event}', function(){{$postPjaxJs}})";
}
if ($js != $container) {
$view->registerJs("{$js};");
}
Pjax::begin($this->pjaxSettings['options']);
echo ArrayHelper::getValue($this->pjaxSettings, 'beforeGrid', '');
}
示例2: renderPjax
protected function renderPjax()
{
if (!$this->pjax) {
return;
}
$view = $this->getView();
if (empty($this->pjaxSettings['options']['id'])) {
$this->pjaxSettings['options']['id'] = $this->options['id'] . '-pjax';
}
$container = 'jQuery("#' . $this->pjaxSettings['options']['id'] . '")';
if (ArrayHelper::getvalue($this->pjaxSettings, 'neverTimeout', true)) {
$view->registerJs("{$container}.on('pjax:timeout', function(e){e.preventDefault()});");
}
$loadingCss = ArrayHelper::getvalue($this->pjaxSettings, 'loadingCssClass', 'kv-grid-loading');
$postPjaxJs = '';
if ($loadingCss !== false) {
$grid = 'jQuery("#' . $this->containerOptions['id'] . '")';
if ($loadingCss === true) {
$loadingCss = 'kv-grid-loading';
}
$view->registerJs("{$container}.on('pjax:send', function(){{$grid}.addClass('{$loadingCss}')});");
$postPjaxJs = "{$grid}.removeClass('{$loadingCss}');";
}
if (!empty($this->_jsExportScript)) {
$id = 'jQuery("#' . $this->id . ' .export-csv")';
$postPjaxJs .= "\n{$this->_jsExportScript}";
}
if (!empty($this->_jsFloatTheadScript)) {
$postPjaxJs .= "\n{$this->_jsFloatTheadScript}";
}
if (!empty($postPjaxJs)) {
$view->registerJs("{$container}.on('pjax:complete', function(){{$postPjaxJs}});");
}
Pjax::begin($this->pjaxSettings['options']);
echo ArrayHelper::getValue($this->pjaxSettings, 'beforeGrid', '');
}