public function setPagination($value)
 {
     if (is_array($value)) {
         $config = ['class' => Pagination::className(), 'pageSizeParam' => 'pageSize'];
         $this->_pagination = Yii::createObject(array_merge($config, $value));
     } elseif ($value instanceof Pagination || $value === false) {
         $this->_pagination = $value;
     } else {
         throw new InvalidParamException('Only Pagination instance, configuration array or false is allowed.');
     }
 }
Exemplo n.º 2
0
 /**
  * @inheritdoc
  */
 public function bootstrap($app)
 {
     if ($app instanceof \yii\web\Application && ($i18nModule = Yii::$app->getModule('i18n'))) {
         $moduleId = $i18nModule->id;
         $app->getUrlManager()->addRules(['translations/<id:\\d+>' => $moduleId . '/default/update', 'translations/page/<page:\\d+>' => $moduleId . '/default/index', 'translations/index' => $moduleId . '/default/index'], false);
         Yii::$container->set(Pagination::className(), ['pageSizeLimit' => [1, 100], 'defaultPageSize' => $i18nModule->pageSize]);
     }
     if ($app instanceof \yii\console\Application) {
         if (!isset($app->controllerMap['i18n'])) {
             $app->controllerMap['i18n'] = I18nController::className();
         }
     }
 }
Exemplo n.º 3
0
 /**
  * Имя класса пагинатора
  * @return string
  */
 public function paginationClassName()
 {
     return Pagination::className();
 }
Exemplo n.º 4
0
<?php

Yii::$container->set(\yii\data\Pagination::className(), \frontend\components\Pagination::className());
Exemplo n.º 5
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     if (!isset($this->view)) {
         $this->view = $this->id;
     }
     if (!isset($this->requestKey)) {
         $this->requestKey = $this->searchKey;
     }
     if ($this->modelPolicy == static::MODEL_POLICY_NONE) {
         $this->modelSearchPolicy = static::MODEL_SEARCH_POLICY_NONE;
     }
     if (is_string($this->finder)) {
         $this->finder = Yii::createObject(['class' => $this->finder]);
     }
     if (true === $this->pagination) {
         $this->pagination = Yii::$container->get(Pagination::className());
     }
 }