kop\y2sp\ScrollPager::init PHP Méthode

init() public méthode

Initializes the pager.
public init ( )
    public function init()
    {
        parent::init();
        // Register translations source
        Yii::$app->i18n->translations = ArrayHelper::merge(Yii::$app->i18n->translations, ['kop\\y2sp' => ['class' => PhpMessageSource::className(), 'basePath' => '@vendor/kop/yii2-scroll-pager/messages', 'fileMap' => ['kop\\y2sp' => 'general.php']]]);
        // Register required assets
        $this->registerAssets();
        // Set default trigger text if not set
        if ($this->triggerText === null) {
            $this->triggerText = Yii::t('kop\\y2sp', 'Load more items');
        }
        // Set default "none left" message text if not set
        if ($this->noneLeftText === null) {
            $this->noneLeftText = Yii::t('kop\\y2sp', 'You reached the end');
        }
    }

Usage Example

 public function init()
 {
     parent::init();
     Asset::register($this->getView());
 }