From 47d74a8ee3ba2003ac89cdc767f631f7e466357f Mon Sep 17 00:00:00 2001 From: Massimiliano Arione Date: Fri, 4 Oct 2024 15:57:18 +0200 Subject: [PATCH] rename option --- README.md | 4 ++-- config/paginator.xml | 2 +- src/DependencyInjection/Configuration.php | 2 +- src/DependencyInjection/KnpPaginatorExtension.php | 2 +- tests/DependencyInjection/ConfigurationTest.php | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 2b28dfd..4a1b6af 100644 --- a/README.md +++ b/README.md @@ -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 @@ -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 diff --git a/config/paginator.xml b/config/paginator.xml index 2b37e4b..4c3c916 100644 --- a/config/paginator.xml +++ b/config/paginator.xml @@ -57,7 +57,7 @@ %knp_paginator.page_name% - %knp_paginator.remove_page_1_link% + %knp_paginator.remove_first_page_param% diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 3769d58..7af5b8d 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -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() diff --git a/src/DependencyInjection/KnpPaginatorExtension.php b/src/DependencyInjection/KnpPaginatorExtension.php index 7313ae9..d79d344 100644 --- a/src/DependencyInjection/KnpPaginatorExtension.php +++ b/src/DependencyInjection/KnpPaginatorExtension.php @@ -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', [[ diff --git a/tests/DependencyInjection/ConfigurationTest.php b/tests/DependencyInjection/ConfigurationTest.php index f43b309..2de591d 100644 --- a/tests/DependencyInjection/ConfigurationTest.php +++ b/tests/DependencyInjection/ConfigurationTest.php @@ -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); } @@ -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]);