---
title: "Reusable Pagerfanta Configurations"
package: "PagerfantaBundle"
version: "2.x"
canonical_url: "https://www.babdev.com/open-source/packages/pagerfantabundle/docs/2.x/reusing-options"
package_supported: true
version_released: true
end_of_support: "2021-12-31T23:59:59.999Z"
notice:
  - "Version 2.x of PagerfantaBundle reached end of support on 2021-12-31."
---
# Reusable Pagerfanta Configurations

Sometimes you want to reuse options for a view in your project and you don't want to repeat those options each time you render a view, or you have different configurations for a view and you want to save those configurations to be able to change them easily.

For this you can define views with the `Pagerfanta\View\OptionableView` class, which is a decorator for any `Pagerfanta\View\ViewInterface` instance.

```yaml
services:
    # Use in Twig by calling {{ pagerfanta(pager, 'low_proximity_and_spanish_messages') }}
    pagerfanta.view.low_proximity_and_spanish_messages:
        class: Pagerfanta\View\OptionableView
        arguments:
            - @pagerfanta.view.default
            - { proximity: 2, prev_message: Anterior, next_message: Siguiente }
        public: false
        tags:
            - { name: pagerfanta.view, alias: low_proximity_and_spanish_messages }

    # Use in Twig by calling {{ pagerfanta(pager, 'high_proximity') }}
    pagerfanta.view.high_proximity:
        class: Pagerfanta\View\OptionableView
        arguments:
            - @pagerfanta.view.default
            - { proximity: 5 }
        public: false
        tags:
            - { name: pagerfanta.view, alias: high_proximity }
```
