Version No Longer Supported

You are viewing the documentation for the 2.x branch of the PagerfantaBundle package which reached is no longer supported as of December 31, 2021. You are advised to upgrade as soon as possible to a supported version.

Adding Views

Views are added to the service container with the pagerfanta.view tag. You can also specify an alias which is used as the view's name in a Pagerfanta\View\ViewFactoryInterface instance, but if one is not given then the service ID is used instead.

It is recommended that view services are NOT public services, the ViewFactoryInterface should be used to retrieve views.

XML Configuration

        <!-- Use in Twig by calling {{ pagerfanta(pager, 'default') }} -->
        <service id="pagerfanta.view.default" class="Pagerfanta\View\DefaultView" public="false">
            <tag name="pagerfanta.view" alias="default" />

        <!-- Use in Twig by calling {{ pagerfanta(pager, 'pagerfanta.view.semantic_ui') }} -->
        <service id="pagerfanta.view.semantic_ui" class="Pagerfanta\View\SemanticUiView" public="false">
            <tag name="pagerfanta.view" />

YAML Configuration

    # Use in Twig by calling {{ pagerfanta(pager, 'default') }}
        class: Pagerfanta\View\DefaultView
        public: false
            - { name: pagerfanta.view, alias: default }

    # Use in Twig by calling {{ pagerfanta(pager, 'pagerfanta.view.semantic_ui') }}
        class: Pagerfanta\View\SemanticUiView
        public: false
            - { name: pagerfanta.view }