Skip to content

Commit 1699a1a

Browse files
committed
Issue #35: Separate method for assets registration
1 parent c6b77ff commit 1699a1a

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

ScrollPager.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace kop\y2sp;
44

55
use kop\y2sp\assets\InfiniteAjaxScrollAsset;
6+
use Yii;
67
use yii\base\InvalidConfigException;
78
use yii\base\Widget;
89
use yii\helpers\ArrayHelper;
@@ -11,7 +12,6 @@
1112
use yii\web\JsExpression;
1213
use yii\web\View;
1314
use yii\widgets\LinkPager;
14-
use Yii;
1515

1616
/**
1717
* ScrollPager turns your regular paginated page into an infinite scrolling page using AJAX.
@@ -240,7 +240,7 @@ public function init()
240240
]);
241241

242242
// Register required assets
243-
InfiniteAjaxScrollAsset::register($this->view);
243+
$this->registerAssets();
244244

245245
// Set default trigger text if not set
246246
if ($this->triggerText === null) {
@@ -340,6 +340,17 @@ public function run()
340340
]);
341341
}
342342

343+
/**
344+
* Register required asset bundles.
345+
*
346+
* You can override this method in case if you want to use your own JQuery Infinite Ajax Scroll plugin files
347+
* (for example, some forked plugin version).
348+
*/
349+
protected function registerAssets()
350+
{
351+
InfiniteAjaxScrollAsset::register($this->view);
352+
}
353+
343354
/**
344355
* Register jQuery IAS extensions.
345356
*
@@ -419,7 +430,7 @@ protected function registerEventHandlers(array $config)
419430
*/
420431
protected function checkEnabledExtensions($extensions)
421432
{
422-
$extensions = (array) $extensions;
433+
$extensions = (array)$extensions;
423434
if (empty($extensions)) {
424435
return true;
425436
} else {

0 commit comments

Comments
 (0)