Hi,
Problem/Motivation
I have encountered a problem with pagination. I am using version RC1 of UI SUITE DSFR and Drupal 10.2. The hook_ui_suite_dsfr_preprocess_pager(array &$variables) function alters page management with the following line:
$variables["items"]["pages"] = LinksSettingType::normalize($variables["items"]["pages"]);
However, before entering the LinksSettingType::normalize function, the $variables["items"]["pages"] array contains the following keys corresponding to the page numbers:
array:6 [▼
4 => array:2 [▶]
5 => array:2 [▶]
6 => array:2 [▶]
7 => array:2 [▶]
8 => array:2 [▶]
9 => array:2 [▶]
]
After passing through the LinksSettingType::normalize function, the array is output with the following keys:
array:6 [▼
0 => array:3 [▶]
1 => array:3 [▶]
2 => array:3 [▶]
3 => array:3 [▶]
4 => array:3 [▶]
5 => array:3 [▶]
]
This results in the loss of the page index, and as a result, the following code:
$current = $variables["current"] - 1;
unset($variables["items"]["pages"][$current]["url"]);
cannot function correctly and leads to inconsistent pagination
Suggested Solution
- Either find an alternative to
LinksSettingType::normalize. - Remove the two lines causing the malfunction and manage the deletion of the URL by searching for the page with the attribute aria-current="page".
Issue fork ui_suite_dsfr-3450577
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
martygraphie commentedComment #4
martygraphie commentedComment #5
pdureau commentedComment #7
pdureau commented