src/GridFieldConfigurablePaginator.php
public function getTemplateParameters(GridField $gridField)
    {
        $state = $this->getGridPagerState();
        if (is_numeric($state->pageSize)) {
            $this->setItemsPerPage($state->pageSize);
        }
        $arguments = $this->getPagerArguments();

        // Figure out which page and record range we're on
        if (!$arguments['total-rows']) {
            return null;
        }

        // Define a list of the FormActions that should be generated for pager controls (see getPagerActions())
        $controls = array(
            'first' => array(
                'title' => 'First',
                'args' => array('first-shown' => 1),
                'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-double-left '
                    . 'ss-gridfield-pagination-action ss-gridfield-firstpage',
                'disable-previous' => ($this->getCurrentPage() == 1)
            ),
            'prev' => array(
                'title' => 'Previous',
                'args' => array('first-shown' => $arguments['first-shown'] - $this->getItemsPerPage()),
                'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-left '
                    . 'ss-gridfield-pagination-action ss-gridfield-previouspage',
                'disable-previous' => ($this->getCurrentPage() == 1)
            ),
            'next' => array(
                'title' => 'Next',
                'args' => array('first-shown' => $arguments['first-shown'] + $this->getItemsPerPage()),
                'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-right '
                .'ss-gridfield-pagination-action  ss-gridfield-nextpage',
                'disable-next' => ($this->getCurrentPage() == $arguments['total-pages'])
            ),
            'last' => array(
                'title' => 'Last',
                'args' => array('first-shown' => ($this->getTotalPages() - 1) * $this->getItemsPerPage() + 1),
                'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-double-right '
                    . 'ss-gridfield-pagination-action ss-gridfield-lastpage',
                'disable-next' => ($this->getCurrentPage() == $arguments['total-pages'])
            ),
            'pagesize' => array(
                'title' => 'Page Size',
                'args' => array('first-shown' => $arguments['first-shown']),
                'extra-class' => 'ss-gridfield-pagination-action ss-gridfield-pagesize-submit'
            ),
        );

        if ($controls['prev']['args']['first-shown'] < 1) {
            $controls['prev']['args']['first-shown'] = 1;
        }

        $actions = $this->getPagerActions($controls, $gridField);

        // Render in template
        return ArrayData::create(array(
            'OnlyOnePage' => ($arguments['total-pages'] == 1),
            'FirstPage' => $actions['first'],
            'PreviousPage' => $actions['prev'],
            'NextPage' => $actions['next'],
            'LastPage' => $actions['last'],
            'PageSizesSubmit' => $actions['pagesize'],
            'CurrentPageNum' => $this->getCurrentPage(),
            'NumPages' => $arguments['total-pages'],
            'FirstShownRecord' => $arguments['first-shown'],
            'LastShownRecord' => $arguments['last-shown'],
            'NumRecords' => $arguments['total-rows'],
            'PageSizes' => $this->getPageSizesAsList(),
            'PageSizesName' => $gridField->getName() . '[page-sizes]',
        ));
    }
public function getTemplateParameters(GridField $gridField)
    {
        $state = $this->getGridPagerState();
        if (is_numeric($state->pageSize)) {
            $this->setItemsPerPage($state->pageSize);
        }
        $arguments = $this->getPagerArguments();

        // Figure out which page and record range we're on
        if (!$arguments['total-rows']) {
            return null;
        }

        // Define a list of the FormActions that should be generated for pager controls (see getPagerActions())
        $controls = array(
            'first' => array(
                'title' => 'First',
                'args' => array('first-shown' => 1),
                'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-double-left '
                    . 'ss-gridfield-pagination-action ss-gridfield-firstpage',
                'disable-previous' => ($this->getCurrentPage() == 1)
            ),
            'prev' => array(
                'title' => 'Previous',
                'args' => array('first-shown' => $arguments['first-shown'] - $this->getItemsPerPage()),
                'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-left '
                    . 'ss-gridfield-pagination-action ss-gridfield-previouspage',
                'disable-previous' => ($this->getCurrentPage() == 1)
            ),
            'next' => array(
                'title' => 'Next',
                'args' => array('first-shown' => $arguments['first-shown'] + $this->getItemsPerPage()),
                'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-right '
                .'ss-gridfield-pagination-action  ss-gridfield-nextpage',
                'disable-next' => ($this->getCurrentPage() == $arguments['total-pages'])
            ),
            'last' => array(
                'title' => 'Last',
                'args' => array('first-shown' => ($this->getTotalPages() - 1) * $this->getItemsPerPage() + 1),
                'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-double-right '
                    . 'ss-gridfield-pagination-action ss-gridfield-lastpage',
                'disable-next' => ($this->getCurrentPage() == $arguments['total-pages'])
            ),
            'pagesize' => array(
                'title' => 'Page Size',
                'args' => array('first-shown' => $arguments['first-shown']),
                'extra-class' => 'ss-gridfield-pagination-action ss-gridfield-pagesize-submit'
            ),
        );

        if ($controls['prev']['args']['first-shown'] < 1) {
            $controls['prev']['args']['first-shown'] = 1;
        }

        $actions = $this->getPagerActions($controls, $gridField);

        // Render in template
        return ArrayData::create(array(
            'OnlyOnePage' => ($arguments['total-pages'] == 1),
            'FirstPage' => $actions['first'],
            'PreviousPage' => $actions['prev'],
            'NextPage' => $actions['next'],
            'LastPage' => $actions['last'],
            'PageSizesSubmit' => $actions['pagesize'],
            'CurrentPageNum' => $this->getCurrentPage(),
            'NumPages' => $arguments['total-pages'],
            'FirstShownRecord' => $arguments['first-shown'],
            'LastShownRecord' => $arguments['last-shown'],
            'NumRecords' => $arguments['total-rows'],
            'PageSizes' => $this->getPageSizesAsList(),
            'PageSizesName' => $gridField->getName() . '[page-sizes]',
        ));
    }
public function getTemplateParameters ( GridField $ gridField ) { $ state = $ this -> getGridPagerState ( ) ; if ( is_numeric ( $ state -> pageSize ) ) { $ this -> setItemsPerPage ( $ state -> pageSize ) ; } $ arguments = $ this -> getPagerArguments ( ) ; // Figure out which page and record range we're on if ( ! $ arguments [ 'total-rows' ] ) { return null ; } // Define a list of the FormActions that should be generated for pager controls (see getPagerActions()) $ controls = array ( 'first' => array ( 'title' => 'First' , 'args' => array ( 'first-shown' => 1 ) , 'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-double-left ' . 'ss-gridfield-pagination-action ss-gridfield-firstpage' , 'disable-previous' => ( $ this -> getCurrentPage ( ) == 1 ) ) , 'prev' => array ( 'title' => 'Previous' , 'args' => array ( 'first-shown' => $ arguments [ 'first-shown' ] - $ this -> getItemsPerPage ( ) ) , 'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-left ' . 'ss-gridfield-pagination-action ss-gridfield-previouspage' , 'disable-previous' => ( $ this -> getCurrentPage ( ) == 1 ) ) , 'next' => array ( 'title' => 'Next' , 'args' => array ( 'first-shown' => $ arguments [ 'first-shown' ] + $ this -> getItemsPerPage ( ) ) , 'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-right ' . 'ss-gridfield-pagination-action  ss-gridfield-nextpage' , 'disable-next' => ( $ this -> getCurrentPage ( ) == $ arguments [ 'total-pages' ] ) ) , 'last' => array ( 'title' => 'Last' , 'args' => array ( 'first-shown' => ( $ this -> getTotalPages ( ) - 1 ) * $ this -> getItemsPerPage ( ) + 1 ) , 'extra-class' => 'btn btn-secondary btn--hide-text btn-sm font-icon-angle-double-right ' . 'ss-gridfield-pagination-action ss-gridfield-lastpage' , 'disable-next' => ( $ this -> getCurrentPage ( ) == $ arguments [ 'total-pages' ] ) ) , 'pagesize' => array ( 'title' => 'Page Size' , 'args' => array ( 'first-shown' => $ arguments [ 'first-shown' ] ) , 'extra-class' => 'ss-gridfield-pagination-action ss-gridfield-pagesize-submit' ) , ) ; if ( $ controls [ 'prev' ] [ 'args' ] [ 'first-shown' ] < 1 ) { $ controls [ 'prev' ] [ 'args' ] [ 'first-shown' ] = 1 ; } $ actions = $ this -> getPagerActions ( $ controls , $ gridField ) ; // Render in template return ArrayData :: create ( array ( 'OnlyOnePage' => ( $ arguments [ 'total-pages' ] == 1 ) , 'FirstPage' => $ actions [ 'first' ] , 'PreviousPage' => $ actions [ 'prev' ] , 'NextPage' => $ actions [ 'next' ] , 'LastPage' => $ actions [ 'last' ] , 'PageSizesSubmit' => $ actions [ 'pagesize' ] , 'CurrentPageNum' => $ this -> getCurrentPage ( ) , 'NumPages' => $ arguments [ 'total-pages' ] , 'FirstShownRecord' => $ arguments [ 'first-shown' ] , 'LastShownRecord' => $ arguments [ 'last-shown' ] , 'NumRecords' => $ arguments [ 'total-rows' ] , 'PageSizes' => $ this -> getPageSizesAsList ( ) , 'PageSizesName' => $ gridField -> getName ( ) . '[page-sizes]' , ) ) ; }
Add the configurable page size options to the template data

{@inheritDoc}

@param  GridField $gridField
@return ArrayData|null
Add the configurable page size options to the template data