- 🇸🇮Slovenia miha.wagner
Can also confirm this is an issue on parents with several hundred children.
Hello,
first and foremost, I did search around the issue queue for my specific problem, but could not find something related to my problem, (except one, which I'll link to in a minute).
Problem :
I have a vocabulary consisting of three parents, and each of those parents has a lot of children, which in turn have a lot of children (max_level : 4). And I do mean a lot : first parent has 250 + terms alltogether.
When I go the the Term Overview page, I see all of the children of the first parent, and the pager says 3 pages are to follow. Now what happens is, if I go the next page I see the exact same output of the first page, and my second parent at the bottom. The same happens when I go to page 3, but then it shows the remaining 2 parent terms.
Research :
I've been digging in code (more specifically in /core/modules/taxonomy/src/Form/OverviewTerms.php ) where I came across this code :
// Do not let a term start the page that is not at the root.
$term = $tree[$tree_index];
if (isset($term->depth) && ($term->depth > 0) && !isset($back_step)) {
$back_step = 0;
while ($pterm = $tree[--$tree_index]) {
$before_entries--;
$back_step++;
if ($pterm->depth == 0) {
$tree_index--;
// Jump back to the start of the root level parent.
continue 2;
}
}
}
Now, what I believe this does is quite simple : when deciding the terms to render on a page, it checks if a term is indeed at the root level before 'cutting it' at that term and displaying the rest at the next page. What happens in my case is that , because I have 3 parent terms and the first one has 250+ children, the parent and its children are all displayed on the pages, because it never gets to 'cut' the array of terms to show.
Hence, it just shows everything until it reaches the next root (which is my second parent).
(I know, my phrasing could be a bit better, but I believe you know what I mean :) )
The pagination just says three pages, because it divides the total number of terms (250+) in 'chunks' of 100 (the setting in taxonomy config files).
Now, I do believe this 'works as designed', because the pagination is correct in assuming there will be three pages (in my case), but there should be a better way to display a root parent term with 100+ terms, because this is the real issue here : any root parent term with 100+ children will be displayed in this manner.
I do believe this is related to https://www.drupal.org/node/242324 → , which is where this code was introduced in the first place. And for 99% of the websites, this will work like a charm, but in this case it does not :)
ATM I'll be investigating contrib modules to adress this problem, as I do not see an easy solution for this. I just thought I'd mention this problem.
I haven't supplied screenshots, because of the amount of terms. If need be, I'll supply some.
Active
9.5
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Can also confirm this is an issue on parents with several hundred children.