Skip to content

Commit

Permalink
rename option
Browse files Browse the repository at this point in the history
  • Loading branch information
garak committed Oct 4, 2024
1 parent 437b124 commit 47d74a8
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ You can configure default query parameter names and templates, and a few other o
knp_paginator:
convert_exception: false # throw a 404 exception when an invalid page is requested
page_range: 5 # number of links shown in the pagination menu (e.g: you have 10 pages, a page_range of 3, on the 5th page you'll see links to page 4, 5, 6)
remove_page_1_link: false # remove the page query parameter from the first page link
remove_first_page_param: false # remove the page query parameter from the first page link
default_options:
page_name: page # page query parameter name
sort_field_name: sort # sort field query parameter name
Expand Down Expand Up @@ -107,7 +107,7 @@ return static function (ContainerConfigurator $configurator): void
$configurator->extension('knp_paginator', [
'convert_exception' => false, // throw a 404 exception when an invalid page is requested
'page_range' => 5, // number of links shown in the pagination menu (e.g: you have 10 pages, a page_range of 3, on the 5th page you'll see links
'remove_page_1_link' => false, // remove the page query parameter from the first page link
'remove_first_page_param' => false, // remove the page query parameter from the first page link
'default_options' => [
'page_name' => 'page', // page query parameter name
'sort_field_name' => 'sort', // sort field query parameter name
Expand Down
2 changes: 1 addition & 1 deletion config/paginator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<service id="Knp\Bundle\PaginatorBundle\Twig\Extension\PaginationRuntime">
<argument type="service" id="knp_paginator.helper.processor" />
<argument type="string">%knp_paginator.page_name%</argument>
<argument>%knp_paginator.remove_page_1_link%</argument>
<argument>%knp_paginator.remove_first_page_param%</argument>
<tag name="twig.runtime" />
</service>
</services>
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function getConfigTreeBuilder(): TreeBuilder
->booleanNode('convert_exception')
->defaultFalse()
->end()
->booleanNode('remove_page_1_link')
->booleanNode('remove_first_page_param')
->defaultFalse()
->end()
->end()
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/KnpPaginatorExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function load(array $configs, ContainerBuilder $container): void
$container->setParameter('knp_paginator.page_range', $config['page_range']);
$container->setParameter('knp_paginator.page_limit', $config['page_limit']);
$container->setParameter('knp_paginator.page_name', $config['default_options']['page_name']);
$container->setParameter('knp_paginator.remove_page_1_link', $config['remove_page_1_link']);
$container->setParameter('knp_paginator.remove_first_page_param', $config['remove_first_page_param']);

$paginatorDef = $container->getDefinition('knp_paginator');
$paginatorDef->addMethodCall('setDefaultPaginatorOptions', [[
Expand Down
4 changes: 2 additions & 2 deletions tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function testDefaultConfig(): void
'page_range' => 5,
'page_limit' => null,
'convert_exception' => false,
'remove_page_1_link' => false,
'remove_first_page_param' => false,
], $config);
}

Expand Down Expand Up @@ -79,7 +79,7 @@ public function testCustomConfig(): void
'page_range' => 15,
'page_limit' => 100,
'convert_exception' => true,
'remove_page_1_link' => false,
'remove_first_page_param' => false,
];
$config = $this->processor->processConfiguration($this->configuration, ['knp_paginator' => $expected]);

Expand Down

0 comments on commit 47d74a8

Please sign in to comment.