Download the PHP package nadialabs/paginator-bundle without Composer
On this page you can find all versions of the php package nadialabs/paginator-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download nadialabs/paginator-bundle
More information about nadialabs/paginator-bundle
Files in nadialabs/paginator-bundle
Package paginator-bundle
Short Description Yet another Paginator bundle
License MIT
Homepage https://github.com/NadiaLabs/PaginatorBundle
Informations about the package paginator-bundle
NadiaPaginatorBundle
NadiaPaginatorBundle can help you build pagination UI quickly. You can design your filter and search UI with Symfony Form component, and easily validate input parameters with Form.
Installation
Install with composer , run:
Register Bundle to AppKernel
Bundle Configuration
- default_options
- input_key_class: The class that define the http request parameter keys.
- default_page_size: Default page size
- default_page_range: Default page range (control page link amounts)
- session_enabled: Enable session support, store input data in session. You can use a clean URL without query string when enabled it. Otherwise the filter, search, sort, page size, and page parameters will be part of URL query string, or transfer by POST request body.
- default_translation_domain: Default
translation-domain
value for each Form.
- templates
- pages: Template for rendering pages
- searches: Template for rendering searches block
- filters: Template for rendering filters block
- sorts: Template for rendering sort selection block
- sort_link: Template for rendering sort link
- page_sizes: Template for rendering page size selection block
Create PaginatorType class
Define a Paginator configuration.
Example class: AppBundle\Paginator\Movies\PaginatorType
You can implement these methods to define a PaginatorType class:
buildSearch
Use SearchBuilder
to setup search form elements with Symfony FormType styles.
buildFilter
Use FilterBuilder
to setup filter form elements with Symfony FormType styles.
buildSort
Use SortBuilder
to setup sorting methods.
buildPageSize
Use PageSizeBuilder
to setup page size list.
getFormOptions
Setup the paginator form options, return an array contain form options.
configureOptions
Setup the paginator options, you can define custom options to injecting extra data into PaginatorType. PaginatorType will use this options in these methods: buildSearch
buildFilter
buildSort
buildPageSize
getFormOptions
.
Create SearchQueryCompiler class
Define a QueryCompiler to build custom search criteria.
Example class for Doctrine QueryBuilder: AppBundle\Paginator\Movies\FilterQueryCompiler
Create FilterQueryCompiler class
Define a QueryCompiler to build custom filter criteria.
Example class for Doctrine QueryBuilder: AppBundle\Paginator\Movies\FilterQueryCompiler
Create Pagination instance with PaginatorType
Example controller: MovieController
Example entities: People
To get a Pagination instance, the process as below:
- Use
PaginatorTypeContainer
to generate a PaginatorType instance. - Use
PaginatorFactory
to generate a Paginator instance with a PaginatorType instance. - Create a query instance (in this example is a Doctrine ORM QueryBuilder instance)
- Do paginate with Paginator, and get a Pagination instance
- Render a view with Pagination instance
Rendering HTML with Twig
You can easily render a list page with this template @NadiaPaginator/templates/bootstrap4/pagination.html.twig
Use twig embed
tag to overwrite tableContent
block and put your table contents in tableContent
block.
Example twig file: index.html.twig
Rendering searches block in Twig
Use nadia_paginator_searches
method to render search block in Twig template.
Rendering filters block in Twig
Use nadia_paginator_filters
method to render filter block in Twig template.
Rendering sorts block in Twig
Use nadia_paginator_sorts
method to render sorting block in Twig template.
Rendering page sizes block in Twig
Use nadia_paginator_page_sizes
method to render page sizes block in Twig template.
Rendering sort link in Twig
All versions of paginator-bundle with dependencies
symfony/config Version ^3.4|^4.0
symfony/dependency-injection Version ^3.4|^4.0
symfony/event-dispatcher Version ^3.4|^4.0
symfony/form Version ^3.4|^4.0
symfony/http-foundation Version ^3.4|^4.0
symfony/http-kernel Version ^3.4|^4.0
symfony/options-resolver Version ^3.4|^4.0
symfony/routing Version ^3.4|^4.0
twig/twig Version ^2.0|^3.0