S
S
Sergey2015-03-31 13:57:53
Yii
Sergey, 2015-03-31 13:57:53

Is there a view setting for PageLinker in Yii2?

Where can I find and change the view file for pagination in yii2?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander N++, 2015-03-31
@butteff

Maybe you had a LinkPager widget?
You can globally change the default settings via DI
Create a base class controllers/base/BaseController.php

namespace app\controllers\base;
use Yii;
class BaseController extends \yii\web\Controller
{
    /**
     * @param string $id
     * @param \yii\base\Module $module
     * @param array $config
     */
    public function __construct($id, $module, $config = [])
    {
       // DI
      Yii::$container->set('yii\widgets\LinkPager', ['maxButtonCount' => 5]);
        return parent::__construct($id,$module,$config);
    }
}

Next apply inheritance in controllers
namespace app\controllers;
use Yii;
class SiteController extends  base\BaseController
{
//...
}

In the case of modules
public function init() {
       Yii::$container->set('yii\widgets\LinkPager', ['maxButtonCount' => 5]);
}

PS LinkPager has no view it's a decorator
https://github.com/yiisoft/yii2/blob/master/docs/g...

A
Alzasr, 2015-03-31
@Alzasr

It's probably better to inherit rather than reconfigure native ones. Native ones are needed for a quick start, and when you customize, it's better to inherit. In addition, Yii2 already uses namespaces, so you can do this with little loss.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question