定制 ssch/typo3-pagerfanta 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

ssch/typo3-pagerfanta

最新稳定版本:v2.0.0

Composer 安装命令:

composer require ssch/typo3-pagerfanta

包简介

Integrates pagerfanta into TYPO3

README 文档

README

Downloads

TYPO3 integration with Pagerfanta Library!

Extension to use Pagerfanta with TYPO3.

Installation & Setup

To install this bundle, run the following Composer command:

composer require ssch/typo3-pagerfanta

Default configuration

plugin.tx_typo3pagerfanta {
    settings {
        # The default Pagerfanta view to use in your application
        default_view = fluid
        # The default fluid template to use when using the Twig Pagerfanta view (available: Foundation6, MaterializeCss, Tailwind, TwitterBootstrap, TwitterBootstrap3, TwitterBootstrap4, TwitterBootstrap5
        default_fluid_template = EXT:typo3_pagerfanta/Resources/Private/Templates/TwitterBootstrap5.html
    }
}

How to use by examples

Imagine you have a classic extbase plugin with an extbase repository query result you want to paginate, then you can use the following example as a starter.

use Psr\Http\Message\ResponseInterface;

final class TestController extends ActionController
{
    public function myCustomAction(int $currentPage = 1): ResponseInterface
    {
        $jobs = $this->jobRepository->findAll();

        $queryResultAdapter = new QueryResultAdapter($jobs);
        $pagination = Pagerfanta::createForCurrentPageWithMaxPerPage($queryResultAdapter, $currentPage, 1);

        $this->view->assign('pagination', $pagination);

        return $this->htmlRepsonse();
    }
}

You then call the PaginationViewHelper in your Fluid template, passing in the Pagination instance. The routes are generated automatically for the current route using the variable "currentPage" to propagate the page number. By default, the extension uses the FluidView with the TwitterBootstrap5 template to render the pagination.

{namespace pagerfanta = Ssch\Typo3Pagerfanta\ViewHelpers}
<pagerfanta:pagination pagerfanta="{pagination}" />
<f:for each="{pagination}" as="job">
    <f:render partial="List" arguments="{job: job}"/>
</f:for>
<pagerfanta:pagination pagerfanta="{pagination}" />

If you are using a parameter other than currentPage for pagination, you can set the parameter name by using the pageParameter option when rendering the pager.

<pagerfanta:pagination pagerfanta="{pagination}" options="{pageParameter: 'page'}" />

If you want to use a different template for the pagination you can set the template by using the template option when rendering the pager.

<pagerfanta:pagination pagerfanta="{pagination}" options="{template: 'EXT:typo3_pagerfanta/Resources/Private/Templates/Foundation6.html'}" />

Why this extension shines

In my opinion this extension or better to say the Pagerfanta concept separates the route generation (RouteGenerator) from the view. So the view is totally agnostic about how to generate the page links itself and so it is fully reusable. To generate the routes inside the controller offers more flexibility instead of generating the page links inside the view itself.

Further Documentation

Please see the BabDev website for detailed information on how to use this extension.

Acknowledgment

This package is heavily inspired by babdev/pagerfanta-bundle by Michael Babker. Thank you.

统计信息

  • 总下载量: 4.15k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 3
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 2
  • Forks: 1
  • 开发语言: HTML

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-02-15

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固