I am using the KNP Paginator bundle for pagination. Does anyone know how to append parameters to the generated url?
Here is my set up:
{{ knp_pagination_sortable(supplierProducts, 'Product Sku', 'p.name') }}
I want to add §ion=supplier to the end of the URL, I just have no clue how to do it. I looked through the docs but did not find any info.
Please help if you can.
Thanks.
You could extend the kn_pagination_sortable template. When you run "knp_pagination_sortable" behind the scenes, it will basically generate an HTML according to your specifications. However, you can extend that. Instead of using the bundle's generated HTML for that element, you can write your own template for that pagination_sortable. This is a snippet from the project I'm working on. This is at my pagination_sortable.html.twig:
<a id="table_sorteable_{{ options['title']|lower }}" {% for attr, value in options %} {{ attr }}="{{ value }}"{% endfor %}>
{{ title }}
<b class="caret {{ options['class'] }}"></b>
</a>
Get it? You can have a template like that and change it according to your needs.
You can find more information on the link below.
According to the KnpPaginator documentation, you can append query parameters as follows:
$paginator = $this->get('knp_paginator');
...
$pagination->setParam('section', 'supplier');