BabDevPagerfantaBundle

Package Update

Twig Support Added to Pagerfanta Bundle

April 18, 2020

The latest version of BabDevPagerfantaBundle is now available which includes support for Twig generated Pagerfanta views.

Starting with the 2.2 release, the bundle extends Pagerfanta to introduce a new TwigView which allows pagers to be rendered fully with the Twig templating engine. This gives designers full control over the rendered markup for their pagers and allows the templating integration to be fully customized to a site's requirements without having to modify a number of PHP classes.

With the creation of the TwigView, the translated Pagerfanta views have been deprecated and will be removed in 3.0. The Twig templates use the same translated strings that the translated view decorators use to allow the messages to be translated, and is a simpler integration in general compared to the translated view decorator classes which require special handling to make the translations work. Therefore, the new TwigView is the preferred way of customizing the output created by Pagerfanta.

Other changes in the 2.2 release include:

  • Extracted Route Generators - The route generator logic was hardcoded into the Twig extension and if your application had router logic that did not follow the Twig extension's setup then you were left to implement your own Twig integration. The route generators have been extracted to a separate API that can be fully customized. This also makes it easier to use the bundle in API only contexts where a response may generate paginated URLs to include in a response.
  • Configuration Deprecations - The babdev_pagerfanta.exceptions_strategy.out_of_range_page and babdev_pagerfanta.exceptions_strategy.not_valid_current_page configuration nodes have had the ability to set them to any value deprecated. These nodes only support two strategies, either the default 404 handling provided by the bundle or a custom strategy for your application, this deprecation updates the configuration to match this behavior.

Plase see the CHANGELOG for all changes in this bundle.